Question: In this assignment, you will be writing a program that reads a list of process start times and durations from stdin. That list will be
In this assignment, you will be writing a program that reads a list of process start times and durations from stdin. That list will be used four times to run through the following CPU scheduling algorithms:
First Come, First Served
Shortest Job First
Shortest Remaining Time First
Round Robin
Your program will show three statistics; the average process response time, the average process wait time, and the average process turnaround time for each scheduling algorithm. The time quantum for the Round Robin scheduler is 100ms. Your program only needs to work with a maximum of 100 processes.
Hints:
Don't overcomplicate this assignment. Keep your process start times in one integer array, your burst times in another integer array, and then refer to those processes via other arrays.
Make four functions, one for each scheduling mechanism. Pass the input data to each function as a parameter. Do not modify your original arrays as you will be reusing the data in those arrays multiple times.
This program is simply an adder of process run times to a clock. Use the value of the clock to determine if new processes need to be added to your queue.
Some students have tried to write a program that increments the clock one tick at a time. This is the difficult way to do it and is also incorrect.
The context switch cost is negligible and is not figured into this assignment.
Output:
With this process list
, the output of your program should look like this:
# ./assn3 First Come, First Served Avg. Resp.:276.40, Avg. T.A.:448.90, Avg. Wait:276.40 Shortest Job First Avg. Resp.:202.90, Avg. T.A.:375.40, Avg. Wait:202.90 Shortest Remaining Time First Avg. Resp.:148.30, Avg. T.A.:353.30, Avg. Wait:180.80 Round Robin with Time Quantum of 100 Avg. Resp.:133.90, Avg. T.A.:555.90, Avg. Wait:383.40
Please note that each average displayed shows a result up to two decimal places.
THE DATA TO BE READ IN.....
For example in this data, 5 is the start time and 100 is the duration!
5 100
11 20
238 80
254 20
330 140
637 220
1042 360
1163 120
1364 170
1404 170
1737 180
1885 40
2149 190
2230 330
2273 360
2327 200
2441 190
2498 110
2875 250
2954 200
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
