Answer: In preemptive scheduling the OS can take the CPU away from a running process (time slice over or a higher-priority process arrives); in non-preemptive scheduling a process keeps the CPU until it finishes or blocks for I/O.
Preemptive scheduling: the scheduler may interrupt the running process and move it back to the ready queue. Examples: Round Robin, Shortest Remaining Time First (SRTF), preemptive priority.
Non-preemptive scheduling: once a process gets the CPU it runs until it terminates or waits (I/O, wait()). Examples: FCFS, SJF (non-preemptive), non-preemptive priority.
| Point | Preemptive | Non-preemptive |
|---|---|---|
| CPU release | Can be forced to leave the CPU (time quantum expiry or higher-priority arrival) | Leaves the CPU only on termination or when it blocks |
| When scheduler runs | Running to ready, waiting to ready, termination, blocking | Only on termination or blocking |
| Priority | A higher-priority arrival takes the CPU at once | Priority can still be used, but only when choosing the next process; the running one is not interrupted |
| Response time | Good; suitable for interactive and real-time systems | Can be poor; a long job delays all short ones (convoy effect) |
| Context switches / overhead | More context switches, more overhead | Fewer context switches, less overhead |
| Starvation | Low-priority processes may starve (unless ageing is used) | Short jobs may wait long behind a long job |
| Shared data | Needs synchronisation, since a process can be interrupted mid-update | Fewer race conditions inside the kernel |
| Complexity | More complex to implement | Simple to implement |
| Examples | Round Robin, SRTF, preemptive priority | FCFS, SJF, non-preemptive priority |