In: Computer Science
Consider following four processes arriving in the order of P1, P2, P3 and P4.
Process Arrival Time CPU burst Time
P1 0.0 6
P2 0.0 8
P3 0.0 7
P4 0.0 3
What is the average waiting time for RR scheduling (time quantum = 5)?
What is the average waiting time for SJF scheduling?
What is the average waiting time for FCFS scheduling?
Question 1) What is the average waiting time for RR scheduling (time quantum = 5)?
P1 completed at 19
P2 completed at 22
P3 completed at 24
P4 completed at 18
Turnaround Time = Complete Time - Arrival Time
19 - 0.0 = 19
22 - 0.0 = 22
24 - 0.0 = 24
18 - 0.0 = 18
Waiting Time = Turnaround Time - CPU burst Time
19 - 6 = 13
22 - 8 = 14
24 - 7 = 17
18 - 3 = 15
Average waiting time for RR scheduling (time quantum = 5) = (13 +14 + 17 + 15) / 4
= 14.75
Average waiting time for RR scheduling = 14.75
Question 2)
What is the average waiting time for SJF scheduling?
P1 completed at 9
P2 completed at 24
P3 completed at 16
P4 completed at 3
Turnaround Time = Complete Time - Arrival Time
9 - 0.0 = 9
24 - 0.0 = 24
16 - 0.0 = 16
3 - 0.0 = 3
Waiting Time = Turnaround Time - CPU burst Time
9 - 6 = 3
24 - 8 = 16
16 - 7 = 9
3 - 3 = 0
Average waiting time for RR scheduling (time quantum = 5) = (13 +14 + 17 + 15) / 4
AAverage waiting time for SJF scheduling = (3 + 16 + 9 + 0) / 4 =
= 28 / 4
Average waiting time for SJF scheduling = 7
Question 3
What is the average waiting time for FCFS scheduling?
P1 completed at 6
P2 completed at 14
P3 completed at 21
P4 completed at 24
Turnaround Time = Complete Time - Arrival Time
6 - 0.0 = 6
14 - 0.0 = 14
21 - 0.0 = 21
24 - 0.0 = 24
Waiting Time = Turnaround Time - CPU burst Time
6 - 6 = 0
14 - 8 = 6
21 - 7 = 14
24 - 3 = 21
Average waiting time for FCFS scheduling = (0 + 6 + 14 + 21) / 4
= 41 / 4
Average waiting time for FCFS scheduling = 10.25
NOTE: If you have any doubt, please let me know through
comments; I will surely revert back to you.
Please give a up vote .....
Thank you...