Given CPU time slice of 2ms and following list of processes.
Process | Burst Time(ms) | Arrival Time |
P1 | 3 | 0 |
P2 | 4 | 2 |
P3 | 5 | 5 |
Find average turnaround time and average waiting time using round robin CPU scheduling?
(A)
4, 0
(B)
5.66, 1.66
(C)
5.66, 0
(D)
7, 2
Answer: (B)
Explanation:
=> Given data in Round Robin CPU scheduling CPU time slice = 2 ms
=> Gantt Chart for given processes: P1,P2,P3
P1 | P2 | P1 | P2 | P3 | P3 | P3 | |
0 | 2 | 4 | 5 | 7 | 9 | 11 | 12 |
Process | Burst time (ms) |
Arrival time |
Completion time |
Turn around time |
Waiting time |
P1 | 3 | 0 | 5 | 5 | 2 |
P2 | 4 | 2 | 7 | 5 | 1 |
P3 | 5 | 5 | 12 | 7 | 2 |
=> Now Average Turnaround Time = ( 5 + 5 + 7 ) / 3
=> = 5.66
=> Average Waiting Time = ( 2 + 1 + 2 ) / 3
=> = 1.66
So, option 2 is correct answer.
Quiz of this Question
Please comment below if you find anything wrong in the above post