Consider the following process:
Process Id |
Arrival Time |
Burst Time |
P0 |
2 |
7 |
P1 |
5 |
10 |
P2 |
7 |
5 |
P3 |
8 |
13 |
What will be completion time for completion time for P1 when round-robin scheduling algorithm is used with a time quantum of 2 ns?
(A) 12.5 ns
(B) 13.25 ns
(C) 15.75 ns
(D) 21 ns
Answer: (B)
Explanation: Using Round-robin Algorithm
Gantt chart will be:
Ready queue:
Turn around time = Completion time – arrival time
P0 = 17 – 2 = 15
P1 = 27 – 5 = 22
P2 = 30 – 7 = 23
P3 = 37 – 9 = 28
Waiting time = Turn around time – burst time
P1 = 15 – 7 = 8
P2 = 22 – 10 = 12
P3 = 23 – 5 = 18
P4 = 28 – 13 = 15
Process Id |
Arrival Time |
Burst Time |
Turn Around Time |
Waiting Time |
P0 |
2 |
7 |
15 |
8 |
P1 |
5 |
10 |
22 |
12 |
P2 |
7 |
5 |
\’
23 |
18 |
P3 |
8 |
13 |
28 |
15 |
Average waiting time = (8 + 12 + 18 + 15 ) / 4 = 53 / 4 = 13.25
So, option (B) is correct.
Quiz of this Question
Share your thoughts in the comments
Please Login to comment...