Question
Three processes arrive at time zero with CPU bursts of 16, 20 and 10 milliseconds. If the scheduler has prior knowledge about the length of the CPU bursts, the minimum achievable average waiting time for these three processes in a non-preemptive scheduler (rounded to nearest integer) is __________ milliseconds.
Official answer and solution
- Official answer
- 12
- From
- Official GATE 2021 answer key
Solution
Apply Shortest Job First (SJF) scheduling, which provably minimizes average waiting time when all processes arrive at time zero.
All three processes arrive at time with burst lengths: .
To achieve minimum average waiting time in a non-preemptive scheduler, the scheduler must execute processes in non-decreasing order of their CPU burst lengths (Shortest Job First).
Execution order:
- executes from to . Waiting time .
- executes from to . Waiting time .
- executes from to . Waiting time .
Total waiting time .
Average waiting time .
12
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2021 Computer Science and Information Technology (CS, Set-1)
- Question
- 35 of 65, printed as CS Q.25
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.