This project is a simulation of an Air Traffic Control (ATC) system using POSIX-compliant C programs. The system includes several processes representing planes, airports, an air traffic controller, passengers, and a cleanup process. Each entity communicates using inter-process communication (IPC) techniques.
The system consists of the following components:
-
Plane Process (
plane.c
):- Simulates passenger and cargo planes.
- Handles user inputs for plane details such as type, weight, and passenger information.
- Manages IPC with passenger processes and the air traffic controller.
-
Air Traffic Controller Process (
airtrafficcontroller.c
):- Directs planes to airports and manages their journey.
- Communicates with plane and airport processes via a single message queue.
- Logs flight details and handles termination requests.
-
Airport Process (
airport.c
):- Simulates airports with multiple runways.
- Manages plane arrivals and departures.
- Ensures planes use the appropriate runways based on their weight.
-
Cleanup Process (
cleanup.c
):- Monitors the system and handles termination requests.
- Ensures a graceful shutdown of the entire system.
- Simulates both passenger and cargo planes.
- Utilizes multi-threading for airport operations.
- Ensures safe communication between processes using message queues and pipes.
- Includes a logging mechanism for tracking plane movements.
To compile the programs, run:
gcc plane.c -o plane.out -lpthread
gcc airtrafficcontroller.c -o airtrafficcontroller.out -lpthread
gcc airport.c -o airport.out -lpthread
gcc cleanup.c -o cleanup.out -lpthread
-
Start the Air Traffic Controller:
./airtrafficcontroller.out
-
Start Airport Processes:
./airport.out
-
Start Plane Processes:
./plane.out
-
Start Cleanup Process:
./cleanup.out
Each program will prompt the user for the necessary inputs. Follow the on-screen instructions to simulate the operations of the ATC system.
For more details on the implementation, refer to the comments in the source code files.