This program simulates a few basic CPU scheduling algorithms
- First come first serve (FCFS)
- Shortest job first (SJF)
- Round robin (RR)
The memory can hold a maximum of 10 jobs at a time in the job queue. A job is loaded into memory by creating a Process Control Block (PCB) for the process and inserting it into the Ready queue. Once a job is completed, it is removed from the job queue and another job is loaded. It can be assumed that there's I/O activity between CPU bursts for each process. A process performing I/O is places in the blocked queue and is moved back into the ready queue once the I/O time (10 time units) is complete.
$ cpusim <algorithm> [time quantum if algorithm == RR] <File name for Jobs>
The algorithm can be FCFS, SJF, or RR
If the algorithm is RR, the time quantum must be specified
The file name for jobs is the name of the file that includes a list of all jobs (in this case it is JobQueue.txt
The input in this case is JobQueue.txt which consists of all the jobs to be simulated. A job described by the following
job_ID arrival_Time cpu_Bursts_Required cpu_Bursts_Sequence
- job ID
- arrival time (time after start that job arrived to the system)
- completion time (time after start that job was completed)
- processing time (total time spent in CPU control + 10 units per I/O task)
- waiting time
- turnaround time
- number of CPU bursts used by the job
- number of jobs in ready queue
- number of jobs in the blocked queue
- number of jobs completed
- scheduling algorithm used
- number of CPU clock cycles elapsed
- average processing time
- average waiting time
- average turnaround time
- average number of CPU bursts used by a job