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...

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 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

Answered 7 days AfterFeb 15, 2021

Answer To: For this assignment you are going to be implementing some OS scheduling algorithms and comparing...

Swapnil answered on Feb 19 2021
148 Votes
Solution/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
Solution/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
Solution/Makefile
CXX = g++
FLAGS = -W -Wall -pedantic-errors -g -std=c++17
LIBRARIES = -lpthread
.PHONY: default run
default: run
run:
    ${CXX} ${FLAGS} *.cpp ${LIBRARIES} -o program
clean:
    -@rm -rf *.o program core
Solution/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
Solution/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
Solution/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
Solution/NewLong.txt
10
P1 0 10
P2 0 10
P3 0 11
P4 0 11
P5 0 12
P6 0 12
P7 0 13
P8 0 13
P9 0 14
P10 0 14
Solution/procList.txt
5
A 0 3
B 2 6
C 4 4
D 6 5
E 8 2
Solution/README.txt
To compile:
-cd into the directory containing the extracted files (schedMain.cpp, schedulers.h, schedulers.cpp)
-enter: make
or: g++ schedMain.cpp schedulers.cpp -o program
To run:
-enter: program
-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 specified
-if millisecond waiting isn't specified, the program will wait for 500ms. Otherwise it will attempt
to parse input as unsigned...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here