Consider the following set of processes with the arrival time and length of…
2025
Consider the following set of processes with the arrival time and length of CPU Burst time given in milli-seconds (ms):
Process | Arrival Time | Burst Time |
P₁ | 0 | 5 |
P₂ | 2 | 3 |
P₃ | 2 | 2 |
P₄ | 5 | 3 |
P₅ | 6 | 1 |
What is the average waiting time for these processes with non-preemptive Shortest Job First (SJF) scheduling Algorithm?
- A.
3.0 ms
- B.
2.1 ms
- C.
4.6 ms
- D.
3.2 ms
Attempted by 239 students.
Show answer & explanation
Correct answer: D
Answer: Average waiting time = 3.2 ms
Scheduling timeline (non-preemptive SJF):
0–5: P1 (burst 5)
5–7: P3 (burst 2) — chosen as the shortest among waiting jobs at time 5
7–8: P5 (burst 1) — arrived at time 6, shortest at time 7
8–11: P2 (burst 3)
11–14: P4 (burst 3)
Waiting times:
P1: start 0, arrival 0 → waiting = 0
P2: start 8, arrival 2 → waiting = 6
P3: start 5, arrival 2 → waiting = 3
P4: start 11, arrival 5 → waiting = 6
P5: start 7, arrival 6 → waiting = 1
Compute average: (0 + 6 + 3 + 6 + 1) / 5 = 16 / 5 = 3.2 ms
A video solution is available for this question — log in and enroll to watch it.