Assignment 1 task 2 - Implement three scheduling algorithms
- First come first serve scheduling (non-preemptive)
- Shortest job first scheduling (non-preemptive)
- Round robin (preemptive, by default quantum = 2 and context switch time = 0.1)
-
Compile the code by running
make
-
The program takes two command line arguments. The first is the location of the processes file. The second is the scheduling algorithm to run. The command to run takes the following format:
./scheduler [location-of-processes-file] [fcfs | sjf | rr]
The processes file has already been included in the submission, so the following commands can be run for each algorithm, after running the make
command in the same directory:
./scheduler processes fcfs
results will be printed to a file named finished_processes_fcfs
The code implementing this algorithm can be found in src/cpu_scheduler.c
in the function called first_come_first_serve
./scheduler processes sjf
results will be printed to a file named finished_processes_sjf
The code implementing this algorithm can be found in src/cpu_scheduler.c
in the function called shortest_job_first
./scheduler processes rr
results will be printed to a file named finished_processes_rr
The code implementing this algorithm can be found in src/cpu_scheduler.c
in the function called round_robin