Consider the following four processes with arrival times (in milliseconds) and…
2021
Consider the following four processes with arrival times (in milliseconds) and their lengths of CPU bursts (in milliseconds) as shown below :

These processes are run on a single processor using preemptive Shortest Remaining Time First scheduling algorithm. If the average waiting time of the processes is 1 millisecond, then the value of Z is
Answer: B. 2 — ConceptShortest Remaining Time First (SRTF) always runs the arrived process with the least remaining CPU time. A newly arrived process preempts the running…
- A.
3
- B.
2
- C.
5
- D.
7
- E.
Question not attempted
Attempted by 373 students.
Show answer & explanation
Correct answer: B
Concept
Shortest Remaining Time First (SRTF) always runs the arrived process with the least remaining CPU time. A newly arrived process preempts the running one only when its burst is shorter than the running process’s remaining time; ties are resolved by the scheduling convention without changing the waiting-time test used here.
For each process, waiting time = completion time − arrival time − CPU burst time. The average waiting time is the sum of all waiting times divided by the number of processes.
Application
From 0 to 1, P1 runs, so its remaining time becomes 2 ms.
At time 1, P2 arrives with a 1 ms burst, which is shorter than P1’s remaining 2 ms. P2 therefore runs from 1 to 2 and finishes.
P1 resumes at time 2. At time 3, P3 arrives with a 3 ms burst while P1 has only 1 ms remaining, so P1 continues and finishes at time 4.
At time 4, P3 has 3 ms remaining and P4 arrives with Z ms. Testing Z = 2 gives P4 only 2 ms, so SRTF selects P4 rather than P3. This directly resolves the choice between P3 and P4 at time 4.
The resulting execution order is P1 (0–1), P2 (1–2), P1 (2–4), P4 (4–6), and P3 (6–9).
Process | Arrival | Burst | Completion | Waiting |
|---|---|---|---|---|
P1 | 0 | 3 | 4 | 4 − 0 − 3 = 1 |
P2 | 1 | 1 | 2 | 2 − 1 − 1 = 0 |
P3 | 3 | 3 | 9 | 9 − 3 − 3 = 3 |
P4 | 4 | 2 | 6 | 6 − 4 − 2 = 0 |
Cross-check
The total waiting time is 1 + 0 + 3 + 0 = 4 ms, so the average is 4 ÷ 4 = 1 ms, exactly as required. Therefore, Z = 2.