Consider the following set of processes, with arrival times and the required…
2013
Consider the following set of processes, with arrival times and the required CPU-burst times given in milliseconds.
Process Arrival Time Burst Time
P1 0 4
P2 2 2
P3 3 1What is the sequence in which the processes are completed? Assume round robin scheduling with a time quantum of 2 milliseconds
- A.
P1, P2, P3
- B.
P2, P1, P3
- C.
P3, P2, P1
- D.
P2, P3, P1
Attempted by 160 students.
Show answer & explanation
Correct answer: B
Concept
Round Robin (RR) gives each process a fixed time quantum, then preempts it and sends it to the BACK of a FIFO ready queue. The completion order therefore depends entirely on the ready-queue ordering. The one rule that decides this problem: when a running process's quantum EXPIRES at the SAME instant a new process ARRIVES, the standard convention places the NEWLY ARRIVED process into the ready queue FIRST, and the just-preempted process is enqueued AFTER it. This single tie-break determines who runs next.
Application (q = 2 ms)
Given: P1(arrival 0, burst 4), P2(arrival 2, burst 2), P3(arrival 3, burst 1). Simulate step by step:
t = 0–2: Only P1 is present, so P1 runs one quantum. Remaining burst of P1 = 4 − 2 = 2.
t = 2 (tie): P1's quantum expires exactly as P2 arrives. By the convention, the arriving P2 is enqueued first, then preempted P1 behind it. Ready queue → [P2, P1].
t = 2–4: P2 runs (burst 2) and finishes at t = 4. Meanwhile P3 arrives at t = 3 and joins the queue behind P1. Ready queue → [P1, P3].
t = 4–6: P1 runs its remaining 2 ms and finishes at t = 6.
t = 6–7: P3 runs its 1 ms and finishes at t = 7.
Cross-check
Read the finish times in order: P2 at t = 4, then P1 at t = 6, then P3 at t = 7. Completion sequence = P2, P1, P3. The total CPU time also checks out: 4 + 2 + 1 = 7 ms with no idle gap, so the schedule ends exactly at t = 7.
Why the common wrong answer appears
If instead you enqueue the preempted P1 BEFORE the arriving P2 at the t = 2 tie, P1 finishes first and you get P1, P2, P3. That ordering uses the opposite tie-break and is not the convention used by this exam; the accepted answer is P2, P1, P3.