Preemptive vs Non-Preemptive Scheduling

Preemptive scheduling can forcibly take the CPU from a running process before it finishes, for example when a time slice expires or a more urgent process arrives, as in Round Robin and SRTF. Non-preemptive scheduling lets a process keep the CPU until it finishes or voluntarily blocks, as in FCFS and non-preemptive SJF.

3 min read

Every CPU scheduling algorithm falls into one of two categories based on a single question: once a process starts running, can the scheduler forcibly interrupt it before it finishes or voluntarily yields?

Non-preemptive scheduling

Once a process is given the CPU, it keeps it until it either finishes entirely or voluntarily blocks (for example, to wait on I/O). The scheduler only makes a new decision at those two moments, a process ending or a process giving up the CPU on its own. FCFS and non-preemptive SJF are the classic examples.

Preemptive scheduling

The scheduler can forcibly take the CPU away from a currently-running process, even if that process hasn't finished and hasn't voluntarily given anything up, usually because a more urgent process needs to run, or because a fixed time slice has expired. Round Robin, Priority Scheduling (in its preemptive form), and SRTF are the classic examples.

The real tradeoff

Non-preemptive scheduling is simpler to implement and has no context-switching overhead beyond what naturally happens when a process finishes or blocks. But it's a poor fit for interactive systems: if a long process is running non-preemptively, every other process, no matter how urgent, has to wait for it to finish or block on its own, which could take a very long time.

Preemptive scheduling adds real overhead (context switches cost real CPU time, and shared data structures need protection from being modified mid-update by an interrupted process, which is exactly why process synchronization matters so much on preemptive systems), but it's what makes responsive, interactive multitasking possible at all.

A worked example illustrating the difference

Three processes arrive: P1 (needs 10 seconds, arrives first), P2 (needs 1 second, arrives right after P1 starts), P3 (needs 1 second, arrives right after P2).

Non-preemptive: P1 starts and runs uninterrupted for its full 10 seconds, since nothing can take the CPU away from it early. P2 and P3, despite each needing only 1 second, both wait the full 10 seconds for P1 to finish before either of them gets to run at all.

Preemptive (say, Round Robin with a 2-second time slice): P1 runs for 2 seconds, then gets preempted so P2 can run. P2 only needs 1 second, so it finishes well within its slice. Then P3 runs and finishes within 1 second too. Only then does P1 resume for its remaining 8 seconds. P2 and P3 both finish far sooner than they would have under the non-preemptive version, at the cost of a couple of extra context switches.

Where this matters in real systems

Every modern general-purpose operating system (Linux, Windows, macOS) uses preemptive scheduling, precisely because users expect their mouse clicks and keystrokes to feel instantaneous even while a heavy background task (a video export, a large compile) is also running. Real-time operating systems used in safety-critical embedded systems also rely heavily on preemption, specifically so a genuinely urgent event (a sensor reading that must be handled within a strict deadline) can always interrupt lower-priority work immediately.

What interviewers actually ask about preemptive vs non-preemptive scheduling

  • "What's the core difference between preemptive and non-preemptive scheduling?" Preemptive scheduling can forcibly interrupt a running process before it finishes or voluntarily yields; non-preemptive scheduling cannot, a process always runs to completion or until it blocks on its own.
  • "Give an example of each." FCFS and non-preemptive SJF are non-preemptive; Round Robin and SRTF are preemptive.
  • "What real cost does preemption introduce?" Context-switching overhead, and the need for synchronization mechanisms to protect shared data from being modified mid-update when a process is interrupted.
  • "Why do virtually all modern general-purpose operating systems use preemptive scheduling?" Because users expect interactive responsiveness (fast reaction to input) even while other, longer processes are also running, which non-preemptive scheduling cannot guarantee.

Key takeaways

  • Non-preemptive scheduling never interrupts a running process before it finishes or blocks voluntarily.
  • Preemptive scheduling can forcibly reclaim the CPU from a running process at any time.
  • Preemption adds context-switch and synchronization overhead but is essential for interactive responsiveness.
  • Virtually all modern general-purpose and real-time operating systems use preemptive scheduling.
All 205 OS interview questions

Browse all Operating Systems topics

Log in to save which topics you've read across every subject.

Frequently asked questions

What's the core difference between preemptive and non-preemptive scheduling?

Preemptive scheduling can forcibly interrupt a running process before it finishes or voluntarily yields; non-preemptive scheduling cannot, a process always runs to completion or until it blocks on its own.

Give an example of each.

FCFS and non-preemptive SJF are non-preemptive; Round Robin and SRTF are preemptive.

What real cost does preemption introduce?

Context-switching overhead, and the need for synchronization mechanisms to protect shared data from being modified mid-update when a process is interrupted.

Why do virtually all modern general-purpose operating systems use preemptive scheduling?

Because users expect interactive responsiveness (fast reaction to input) even while other, longer processes are also running, which non-preemptive scheduling cannot guarantee.