In: Computer Science
Question:
Process | AT | BT | Priority |
A | 0 | 6 | 3 |
B | 1 | 2 | 1 |
C | 3 | 5 | 3 |
D | 5 | 3 | 4 |
E | 7 | 2 | 2 |
a) FCFS
Process | AT | BT | Priority | TAT | WT |
A | 0 | 6 | 3 | 6 | 0 |
B | 1 | 2 | 1 | 7 | 5 |
C | 3 | 5 | 3 | 10 | 5 |
D | 5 | 3 | 4 | 11 | 8 |
E | 7 | 2 | 2 | 11 | 9 |
Turn Around Time: Time Difference between
completion time and arrival time.
Turn Around Time = Completion Time – Arrival Time
Waiting Time(W.T): Time Difference between turn
around time and burst time.
Waiting Time = Turn Around Time – Burst Time
Average Waiting Time = (0+5+5+8+9)/5 = 5.4
Please find Gantt Charts of all scheduling policies:
b) Preemtive Priority Scheduling:
Process | AT | BT | Priority | TAT | WT |
A | 0 | 6 | 3 | 10 | 4 |
B | 1 | 2 | 1 | 2 | 0 |
C | 3 | 5 | 3 | 12 | 7 |
D | 5 | 3 | 4 | 13 | 10 |
E | 7 | 2 | 2 | 2 | 0 |
Average Waiting Time = (4+0+7+10+0)/5 = 4.2
c) HRRN:
The name itself states that we need to find the response ratio of all available processes and select the one with the highest Response Ratio. A process once selected will run till completion.
Criteria – Response Ratio
Mode – Non-Preemptive
Response Ratio = (WT + BT)/BT
At t=6 conflict arises so calculate response ratio of B,C and D.
Response Ration (B) = (5+2)/2 = 3.5
Response Ration (C) = (3+5)/5 = 1.6
Response Ration (D) = (1+3)/3 = 1.33
So B will be selected.
At t=8 conflict arises so calculate response ratio of E,C and D.
Response Ration (E) = (1+2)/2 = 1.5
Response Ration (C) = (5+5)/5 = 2
Response Ration (D) = (3+3)/3 = 2
So C will be selected based on the arrival time as Respose Ration is same .
At t=13 conflict arises so calculate response ratio of E and D.
Response Ration (E) = (8+3)/3 = 3.66
Response Ration (D) = (6+2)/2 = 4
So D will be selected.
Process | AT | BT | Priority | TAT | WT |
A | 0 | 6 | 3 | 6 | 0 |
B | 1 | 2 | 1 | 7 | 5 |
C | 3 | 5 | 3 | 10 | 5 |
D | 5 | 3 | 4 | 11 | 8 |
E | 7 | 2 | 2 | 11 | 9 |
Average Waiting Time = (0+5+5+8+9)/5 = 5.4
d) RR with time quantum 4:
Process | AT | BT | Priority | TAT | WT |
A | 0 | 6 | 3 | 12 | 6 |
B | 1 | 2 | 1 | 5 | 3 |
C | 3 | 5 | 3 | 15 | 10 |
D | 5 | 3 | 4 | 10 | 7 |
E | 7 | 2 | 2 | 10 | 8 |
Average Waiting Time = (6+3+10+7+8)/5 = 6.8
e) Which of the foregoing scheduling policies provides the lowest waiting time for this set of jobs? What is the waiting time with this policy?
Preemtive Priority Scheduling has the lowest waiting times for the set of jobs. Average Waiting Time = (4+0+7+10+0)/5 = 4.2 which is lowest amingst all.