For this assignment you are going to be implementing some OS scheduling algorithms and comparing their performance given different types of process loads and different numbers of processors. Your program is to read in a text file describing the process load to test, perform a run where all processes are run to completion using a user specified scheduler, then report stats on the run after it is done. We have provided you a framework to start from, linked below.
So, addressing those steps in order, the first item is reading in the process load. This is already implemented in the provided framework. The file contains a list of processes, defined by their arrival time and service time. These are read in and stored in a vector of Process structs, which you will be using in your schedulers (see schedulers.h for the struct definition). The framework will accept a file name from the command line (i.e., provided when you start your program, ex: myProg someFile.txt). If a file is not provided, it attempts to open "./procList.txt", which is provided with the framework (this is the example from the Round Robin slides).
The provided framework is also set up to allow the number of processors to be indicated on the command line. If this is not provided, then one processor will be used. So, when calling your program the format is:
myProg
Next is to use a user specified scheduler to run all processes to completion. The user is presented a prompt to select a scheduler from the list of those supported and asked to provide a time quantum, if necessary for the scheduler. The Round Robin scheduler is already implemented in the framework, for your reference. You are to add support for Shortest Process Next (SPN), Shortest Remaining Time (SRT), and Highest Response Ratio Next (HRRN) schedulers. Take note of how Round Robin uses maxNumProcessors and how the return vector is defined (the 'idx' vector in the function). In general, your scheduler can be implemented in any way you see fit. See the Round Robin implementation for an example of implementing it as a function call. The scheduler is to be called once each time step, indicating which processes are to be scheduled for the time step. The length of the return vector should be no longer than the number of processors indicated. If the vector is less than the number of processors, then that is fine (the extra processors will be idle). If no process is selected or an invalid process is indicated, then an auto-generated "idle" process is scheduled for the time step (this is already implemented in the framework for you).
Lastly, you are to report stats on the run. For each process you will report:
-Finish Time
-Turnaround Time
-Normalized Turnaround Time
And you will also report the average Turnaround Time and average Normalized Turnaround Time for all processes.
In the framework code, the sections where you are expected to add functionality are indicated by a TODO comment (there are 4 of them, one for each scheduler and one for the stat calculations). You are free to extend the existing structures/functions as you see fit. If you have questions, be sure to let us know.
Here is the starting framework and some data sets to work with. Feel free to generate additional data sets to test against. The expected file format is followed by " " for each process (see the provided files for examples). The files provided here will be used in grading your program (as well as a few extras, possibly...).
NOTE: when dealing with ties, the current process wins, and the oldest process wins. This is how it should be and ensures the same output. you will lose points if you do not follow this