What is the difference between preemptive and non-preemptive scheduling?
Why Interviewers Ask This
This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex Operating Systems topics. It also reveals how well you can explain technical ideas to non-experts.
Answer
Preemptive scheduling allows the OS to forcibly remove the CPU from a running process and give it to another — without the running process's cooperation. Non-preemptive (cooperative) scheduling relies on processes voluntarily giving up the CPU — by blocking for I/O, calling yield(), or completing. Non-preemptive: Once a process has the CPU, it runs until: it blocks (I/O, semaphore wait), it terminates, it explicitly yields. No timer-based interruptions. Advantages: simple; no context switch overhead from interrupts; predictable behavior; good for batch processing. Disadvantages: poor responsiveness for interactive users; one process can monopolize CPU; not suitable for real-time systems; convoy effect. Examples: original Mac OS (cooperative multitasking), early Windows (pre-95), MS-DOS. Preemptive: Timer interrupts the OS every quantum. OS can preempt any process at any time. Context switch overhead but fair CPU sharing. Advantages: better responsiveness; fairer CPU sharing; supports real-time constraints; prevents monopolization. Disadvantages: more complex; race conditions if shared data not protected; context switch overhead; harder to reason about timing. Examples: Linux, Windows NT+, macOS, Android, iOS — all modern OSes. Preemptive algorithms: Round Robin, Shortest Remaining Time First, Priority Scheduling with preemption, Multilevel Feedback Queue. Real-time systems: need preemptive scheduling with guaranteed response times (safety-critical: avionics, ABS, pacemakers).
Pro Tip
If you're unsure about a detail, say so honestly and explain your reasoning. Interviewers respect candidates who can think through uncertainty rather than bluffing.