This project is a console-based CPU scheduling simulator written in C. It demonstrates and compares common CPU scheduling algorithms used in operating systems.
Implemented algorithms:
- First Come, First Serve (FCFS)
- Shortest Job First (SJF) – Non-preemptive
- Priority Scheduling – Non-preemptive
- Round Robin (RR)
The program calculates scheduling tables, Gantt charts, and performance metrics such as:
- Waiting Time
- Turnaround Time
- Throughput
- CPU Utilization
Results are also exported to CSV files for further analysis.
Compile using GCC:
gcc scheduler.c -o scheduler
- Manual input of processes
- Load processes from a text file
Input file format (input.txt):
<number_of_processes> <arrival_time> <burst_time> <arrival_time> <burst_time> ...
Example: 5 0 7 2 2 4 1 4 1 3 5 2 2 6 3 4
After loading processes, select a scheduling algorithm:
- FCFS
- SJF
- Priority
- Round Robin
For Round Robin, the program will prompt for a time quantum.
The program displays:
- Scheduling tables
- Gantt charts
- Average Waiting Time
- Average Turnaround Time
- Throughput
- CPU Utilization
Results are saved to:
- results.csv
- CPU utilization may appear as 100% when no idle time occurs.
- Round Robin requires a time quantum greater than 0.


