ITPEC FE Morning October 2021 Question 17
In Round Robin scheduling, the CPU-time is shared among processes on the basis of the predefined time slot. There are four processes, namely P1, P2, P3, and P4, and their corresponding CPU-execution times are shown in the table below. All four (4) processes arrive at time 0, in the given order, and waiting time is the total time for which a process has to wait before it obtains its time slice for execution. Each time slot is 10 milliseconds. Which of the following is the average waiting time in milliseconds for the processes to be executed in Round Robin?
Explanation
16.75 ms — build the Round Robin timeline with a 10 ms slot, then add up every period each process spends waiting.
Timeline (P1 10, P2 23, P3 7, P4 3 ms):
- •0–10 P1, done at 10
- •10–20 P2, 13 ms left
- •20–27 P3, done at 27
- •27–30 P4, done at 30
- •30–40 P2, 3 ms left
- •40–43 P2, done at 43
Waiting times (completion − execution, all arrive at 0): P1 10 − 10 = 0, P2 43 − 23 = 20 (0–10 and 20–30), P3 27 − 7 = 20, P4 30 − 3 = 27. Average: (0 + 20 + 20 + 27) ÷ 4 = 67 ÷ 4 = 16.75.
Answer (d)
Why not others:
- •(a) 10.75 — 43 ÷ 4, the average execution time, not the waiting time
- •(b) 14.25 — (0 + 10 + 20 + 27) ÷ 4: counts only the wait before each process first runs and misses P2's second wait, from 20 to 30
- •(c) 15.00 — would need a total wait of 60 ms, but the timeline fixes it at 67
Key rule: In Round Robin a process can wait several times; completion time minus arrival time minus execution time captures every wait at once.
Software · AI-written, may contain errors
This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.