C++ console simulations for common CPU scheduling algorithms studied in Operating Systems coursework. Each program generates process arrival and burst times, prints the scheduling table, calculates average turnaround and waiting time, and displays a simple Gantt chart in the terminal.
- First-Come, First-Served (FCFS)
- Shortest Job First (SJF)
- Round Robin (RR)
.
├── FCFS.cpp
├── SJF.cpp
├── RR.cpp
└── README.md
Each file is standalone and can be compiled separately with any C++17-compatible compiler.
Using g++:
g++ -std=c++17 FCFS.cpp -o fcfs
g++ -std=c++17 SJF.cpp -o sjf
g++ -std=c++17 RR.cpp -o rrUsing Microsoft Visual C++ from a Developer PowerShell:
cl /EHsc FCFS.cpp /Fe:fcfs.exe
cl /EHsc SJF.cpp /Fe:sjf.exe
cl /EHsc RR.cpp /Fe:rr.exe./fcfs
./sjf
./rrOn Windows PowerShell:
.\fcfs.exe
.\sjf.exe
.\rr.exeRound Robin asks for both the number of processes and the time quantum. FCFS and SJF ask for the number of processes.
- Process arrival times and burst times are generated randomly in the range 1 to 10.
- The repository keeps only the clean standalone source files. Visual Studio cache folders, build outputs, and duplicate local project folders are ignored.