Skip to content

Console-based CPU scheduling simulator implementing FCFS, SJF, Priority, and Round Robin algorithms in C.

Notifications You must be signed in to change notification settings

iridiumLotus/cpu-scheduling-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation


CPU Scheduling Simulator

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.


Compilation

Compile using GCC:

gcc scheduler.c -o scheduler


Input Options

  1. Manual input of processes
  2. 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


Menu Options

After loading processes, select a scheduling algorithm:

  1. FCFS
  2. SJF
  3. Priority
  4. Round Robin

For Round Robin, the program will prompt for a time quantum.


Output

The program displays:

  • Scheduling tables
  • Gantt charts
  • Average Waiting Time
  • Average Turnaround Time
  • Throughput
  • CPU Utilization

Results are saved to:

  • results.csv

FCFS Scheduling Output

FCFS Output

Round Robin Gantt Chart

RR Gantt Chart

Algorithm Comparison

Comparison Graph


Notes

  • CPU utilization may appear as 100% when no idle time occurs.
  • Round Robin requires a time quantum greater than 0.

About

Console-based CPU scheduling simulator implementing FCFS, SJF, Priority, and Round Robin algorithms in C.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages