A configurable CPU scheduling simulator written in C that implements and analyzes multiple operating system scheduling policies. The project focuses on correctness, fairness, starvation detection, and empirical performance comparison rather than only algorithm implementation.
- Implements multiple CPU scheduling algorithms:
- First Come First Serve (FCFS)
- Shortest Job First (SJF)
- Shortest Remaining Time First (SRTF – preemptive)
- Priority Scheduling
- Round Robin (configurable time quantum)
- Gantt chart visualization with proper handling of idle CPU time
- Computes key scheduling metrics:
- Average Waiting Time (WT)
- Average Turnaround Time (TAT)
- Fairness (standard deviation of waiting times)
- Starvation detection
- Stress-testing mode to empirically compare scheduling policies on randomized workloads
- Modular design with Makefile-based build system
- Language: C
- Platform: Unix/Linux
- Build System: Makefile
main.c– Command-line interface and control logicscheduler.h– Scheduler function declarationsscheduler_fcfs.c– FCFS scheduling implementationscheduler_sjf.c– Non-preemptive SJF schedulingscheduler_sjf_preemptive.c– Preemptive SJF (SRTF)scheduler_priority.c– Priority schedulingscheduler_rr.c– Round Robin schedulingmetrics.c– Waiting time, turnaround time, fairness, starvation metricsmetrics.hgantt.c– Gantt chart visualizationgantt.hprocess.h– Process data structureconfig.c– Global configuration (e.g., Gantt toggle)config.hprocesses.txt– Input process listMakefile– Build configurationscheduler– Compiled executable
make clean make
This generates the executable scheduler.
./scheduler fcfs ./scheduler sjf ./scheduler priority ./scheduler rr 2
./scheduler all
./scheduler --stress 1000