Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

For this assignment you are going to be implementing some OS scheduling algorithms and comparing their performance given different types of process loads. Your program is to read in a text file...

1 answer below »

For this assignment you are going to be implementing some OS scheduling algorithms and comparing their performance given different types of process loads. 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).

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. 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 process is to be scheduled for the time step. 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...).

Answered Same Day Oct 25, 2021

Solution

Arun Shankar answered on Nov 02 2021
143 Votes
AllLong.txt
10
P1 0 10
P2 0 12
P3 2 14
P4 5 11
P5 6 13
P6 6 10
P7 6 10
P8 8 11
P9 9 11
P10 10 9
AllShort.txt
10
P1 0 2
P2 0 3
P3 2 4
P4 5 3
P5 6 4
P6 6 3
P7 6 2
P8 8 4
P9 9 3
P10 10 4
MostlyLong.txt
10
P1 0 10
P2 0 12
P3 2 4
P4 5 9
P5 6 2
P6 6 10
P7 6 10
P8 8 11
P9 9 3
P10 10 9
MostlyLong_all.txt
10
P1 0 10
P2 0 12
P3 0 4
P4 0 9
P5 0 2
P6 0 10
P7 0 10
P8 0 11
P9 0 3
P10 0 9
MostlyShort.txt
10
P1 0 2
P2 0 10
P3 2 4
P4 5 3
P5 6 4
P6 6 12
P7 6 2
P8 8 4
P9 9 9
P10 10 4
README.txt
To compile:
-cd into the directory containing the extracted files (schedMain.cpp, schedulers.h, schedulers.cpp)
-enter: g++ schedMain.cpp schedulers.cpp -o sched
To run:
-enter: sched -if an input file is not specified, the program will try to read in from "./procList.txt". Otherwise
it will attempt to read the file...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here