CPU Scheduling MCQs for NSCT
CPU scheduling is how the operating system decides which process in the ready queue gets the CPU next, and for how long. The main algorithms are FCFS, SJF (and its preemptive form, SRTF), priority and round robin, and you judge them by waiting, turnaround and response time. It is topic 4 of the Operating Systems area, which carries 5% of the NSCT according to HEC's Areas of Competencies. Operating Systems had the lowest accuracy of any area in 2026, at 33.8%, per the HEC NSCT report and APP, so careful arithmetic here pays off.
Three formulas carry every numerical (for a process with no I/O):
- Turnaround time (TAT) = completion time - arrival time.
- Waiting time (WT) = TAT - CPU burst, which is the time spent in the ready queue.
- Response time = time of first run - arrival time.
A preemptive scheduler can take the CPU away from a running process; a non-preemptive one waits until the process finishes its burst or blocks. Processes and the ready queue are covered in Process Management.
FCFS
First-come, first-served runs processes in arrival order and is non-preemptive. It is simple, but the average wait depends heavily on order.
Example: P1 (12 ms), P2 (3 ms) and P3 (3 ms) all arrive at time 0 in that order. The waits are 0, 12 and 15, so the average is 9 ms. If the short jobs came first, the average would drop to 3 ms.
Exam angle: one long CPU-bound job holding up many short ones is the convoy effect, the classic FCFS weakness.
SJF
Shortest-job-first runs the process with the smallest next CPU burst. Silberschatz calls it "shortest-next-CPU-burst" scheduling. It gives the minimum average waiting time for a given set of processes, but the OS cannot know the next burst in advance, so it predicts it with exponential averaging.
Example: P1 (7), P2 (3), P3 (5) and P4 (1), all at time 0. SJF runs P4, P2, P3, P1, giving waits 0, 1, 4 and 9: an average of 3.5 ms, against 8 ms for FCFS in that order.
The preemptive version is SRTF (shortest-remaining-time-first). With P1 (arrival 0, burst 7), P2 (2, 4) and P3 (4, 1), non-preemptive SJF averages 3 ms of waiting, while SRTF averages 2 ms, because P2 and then P3 preempt P1.
Exam angle: check whether the question says "preemptive"; the two versions give different answers whenever arrivals are staggered.
Priority
Priority scheduling runs the highest-priority process first. It can be preemptive or not. Its risk is starvation (a low-priority process waits indefinitely), and the cure is aging, raising a process's priority the longer it waits.
Where books differ: Silberschatz treats a lower number as a higher priority but notes there is no general agreement. Always read the question's convention.
Example (lower number = higher priority): P1 (arrival 0, burst 5, priority 3), P2 (1, 3, 1), P3 (2, 2, 2).
| Version | Order | Average WT |
|---|---|---|
| Non-preemptive | P1 0-5, P2 5-8, P3 8-10 | 3.33 ms |
| Preemptive | P1 0-1, P2 1-4, P3 4-6, P1 6-10 | 2.33 ms |
Exam angle: SJF is a special case of priority scheduling (priority = predicted burst), so it can starve long jobs too.
Round robin
Round robin (RR) is FCFS with preemption by a fixed time quantum. A process that has not finished when its quantum expires goes to the back of the ready queue.
Example: P1 (5), P2 (3) and P3 (2), all at time 0, quantum 2 ms. The average wait is 5 ms, worse than FCFS's 4.33 ms here, but the average response time is just 2 ms.
The quantum matters. If it is larger than every burst, RR behaves like FCFS. If it is close to the context-switch time, most CPU time goes on switching.
Exam angle: RR usually has a higher average turnaround than SJF but better response time, which is why time-sharing systems use it.
Gantt charts
A Gantt chart is a timeline showing which process holds the CPU in each interval. Draw it first, then read completion and first-run times straight off it. For the round-robin example above:
| P1 | P2 | P3 | P1 | P2 | P1 |
0 2 4 6 8 9 10
Completion times are P3 = 6, P2 = 9 and P1 = 10, so the waits are 4, 6 and 5.
Exam angle: most wrong answers come from skipping the chart and doing the arithmetic in your head.
Common traps
- Using completion time as turnaround time when the process did not arrive at time 0.
- Treating SJF and SRTF as the same algorithm when arrival times differ.
- Assuming a lower priority number always means higher priority; check the stem's convention.
- In round robin, placing a newly arrived process and a preempted process in the wrong order when both join at the same instant. Conventions differ; the common one admits the new arrival first, so follow the stem whenever it states a rule.
- Forgetting that RR with a huge quantum is simply FCFS.
- Calling FCFS or round robin starvation-prone; only SJF, SRTF and priority (without aging) can starve a process.
Worked examples
1. Understanding. Which scheduling criterion matters most to a user typing in an interactive editor? Answer: response time. The user notices how quickly the system first reacts, not when a whole job finishes, which is why interactive systems favour round robin.
2. Application. P1 (arrival 0, burst 6), P2 (1, 4) and P3 (3, 2) are scheduled with round robin, quantum 2 ms. What is the average waiting time? Answer: 4.67 ms. The chart is P1 0-2, P2 2-4, P1 4-6, P3 6-8, P2 8-10, P1 10-12. Completion times 12, 10 and 8 give waits of 6, 5 and 3, so 14/3 = 4.67 ms.
3. Analysis. Four processes arrive at time 0 with bursts P1 = 9, P2 = 1, P3 = 2 and P4 = 3 (queue order P1 to P4). Rank FCFS, SJF and RR (quantum 1) by average waiting time. Answer: SJF 2.5 ms, then RR 4.25 ms, then FCFS 7.75 ms. FCFS suffers the convoy effect behind P1. RR rescues the short jobs but still interleaves them with P1. SJF is optimal. RR does have the best average response time (1.5 ms).
Practise
The quiz below has 99 CPU Scheduling questions, filterable by tier and difficulty.
Practise: 99 questions
FAQs
What is the difference between SJF and SRTF?
SJF is non-preemptive: once a process starts, it runs its whole burst. SRTF is preemptive: when a new process arrives with a burst shorter than the running process's remaining time, it takes the CPU. If all processes arrive together, the two produce the same schedule.
Does round robin cause starvation?
No. With n processes in the ready queue and quantum q, every process gets the CPU within (n - 1) x q time units. Starvation is a risk for SJF, SRTF and priority scheduling without aging, because newly arriving jobs can keep jumping ahead of an old one.
Why is SJF optimal but rarely used directly?
Moving a short job ahead of a long one reduces the short job's wait more than it increases the long job's, so SJF minimises average waiting time. The catch is that the OS cannot know the next CPU burst; it has to predict it, usually by exponential averaging of past bursts.
How do I find waiting time from a Gantt chart?
Read each process's completion time from the chart, subtract its arrival time to get turnaround time, then subtract its CPU burst. For a process that ran in several pieces, this automatically counts every gap it spent in the ready queue.
Next step
Drill longer numericals in CPU Scheduling Numericals, move on to Thread Management, return to the Operating Systems MCQ hub, or take a timed NSCT mock test.