Burst times 24, 3 and 3, all arriving at time 0, with a time quantum of 4 ms. What is the average waiting time under Round Robin?
P1 runs 0-4, P2 4-7, P3 7-10, then P1 alone finishes at 30. Waiting times are P1 6, P2 4, P3 7, so the average is 17 / 3, about 5.67 ms.
Explain it simply
Round Robin is a group of friends passing one controller, each getting a fixed turn. If your game is not over when your turn ends, you go to the back of the line.
Each process runs for at most 4 ms. P2 and P3 need only 3 ms, so they finish within their first turn. P1 needs 24 ms, so it takes 6 turns.
Example
| P1 | P2 | P3 | P1 | P1 | P1 | P1 | P1 |
0 4 7 10 14 18 22 26 30After time 10, P1 is the only process left, so it runs its remaining 20 ms in consecutive turns.
Waiting time = completion time - burst time (all arrive at 0):
- P1: finishes at 30, 30 - 24 = 6
- P2: finishes at 7, 7 - 3 = 4
- P3: finishes at 10, 10 - 3 = 7
Average = (6 + 4 + 7) / 3 = 17 / 3 = 5.67 ms.
RR (5.67 ms) beats FCFS (17 ms) here, and short jobs get a quick first response. SJF (3 ms) still wins on average waiting time, but RR needs no burst-time prediction.
What to say in the interview
"With quantum 4 the order is P1, P2, P3, then P1 for the rest. Completion times are P2 at 7, P3 at 10 and P1 at 30, so waits are 4, 7 and 6, an average of about 5.67 ms. RR is fair and gives good response time without predicting bursts."
Common mistakes
- Counting the P1 waiting as 10 (its first start) instead of its total waiting between turns.
- Forgetting that a process that finishes early gives its unused quantum back.