A C-based simulation of an elevator system developed as a lab project for Operating Systems. The system uses First Come First Serve (FCFS) scheduling to manage elevator requests and demonstrates core OS concepts like process creation and inter-process communication (IPC) using pipes.
Simulate an elevator that processes floor requests in the order they arrive (FCFS). The goal is to calculate:
- Waiting Time
- Completion Time
- Realistic elevator movement between floors
- Randomly generates elevator requests (arrival time, target floor, burst time)
- Parent process creates and sends requests to the child process using pipes
- Child process calculates:
- Waiting time
- Completion time
- Serves each request by simulating floor movement
- Tabular output of request details and timings
- Language: C
- Concepts: Process Creation (
fork()
), Pipes, Structs, Scheduling - Platform: Ubuntu (Linux Terminal)
- Parent process generates 1β5 random elevator requests.
- Sends requests to child process via a pipe.
- Child process:
- Processes each request in FCFS order.
- Simulates elevator travel using
sleep()
based on burst time. - Calculates and prints waiting and completion times.
gcc ecs-code.c -o ecs-code
./ecs-code