What this topic covers
11 subtopics- Round Robin11
- Basics6
- FCFS5
- Priority5
- SRTF5
- SJF4
- HRRN2
- Multilevel queues2
- Other algorithms2
- Real-time2
- Real systems1
- Beginner 15
- Intermediate 15
- Advanced 15
About this topic
Scheduling numericals are the most common OS questions in GATE and placement tests: draw the Gantt chart, then read off completion, turnaround (CT − AT), waiting (TAT − BT) and response times. Each question here shows the process table and, where useful, the Gantt chart; every answer was computed by a scheduling simulator. Conventions: ties go to the process listed first, a lower priority number means higher priority, and in Round Robin a process that arrives as a quantum ends joins the queue before the preempted process.
Free preview
Sample questions
Try each one first, then open the answer for the explanation and why the other options are wrong.
All processes arrive at time 0. What is the average waiting time under non-preemptive SJF?
| Process | Arrival | Burst |
|---|---|---|
| P1 | 0 | 6 |
| P2 | 0 | 8 |
| P3 | 0 | 7 |
| P4 | 0 | 3 |
The answer is a number – work it out, then open the solution.
Show answer and explanation
Explanation
Shortest first: P4 0–3, P1 3–9, P3 9–16, P2 16–24. Waiting 3, 16, 9 and 0 → 28 / 4 = 7.
Which Gantt chart does SRTF (preemptive SJF) produce?
| Process | Arrival | Burst |
|---|---|---|
| P1 | 0 | 8 |
| P2 | 1 | 4 |
| P3 | 2 | 9 |
| P4 | 3 | 5 |
Show answer and explanation
Explanation
At 1, P2 (4) beats P1's remaining 7, so P1 is preempted. At 5 the ready processes have remaining 7 (P1), 9 (P3) and 5 (P4): P4 runs. Then P1 (7) before P3 (9).
Why the other options are wrong
- AAt 5, P4 (5) is shorter than P1 (7).
- CThat is non-preemptive SJF.
- DP1 (7) is shorter than P3 (9).
SRTF scheduling. What is the average turnaround time?
| Process | Arrival | Burst |
|---|---|---|
| P1 | 0 | 12 |
| P2 | 2 | 4 |
| P3 | 3 | 6 |
| P4 | 8 | 5 |
The answer is a number – work it out, then open the solution.
Show answer and explanation
Explanation
Gantt: P1 0–2, P2 2–6, P3 6–12 (at 8 P3 has 4 left, less than P4's 5), P4 12–17, P1 17–27. TAT 27, 4, 9, 9 → 49 / 4 = 12.25.