Preemptive vs non-preemptive priority scheduling

Both schedulers always pick the highest-priority task that is ready. They differ in one thing: when they are allowed to pick. A preemptive scheduler decides again every time a task is released. A non-preemptive scheduler decides only when the processor becomes free. The same task set runs under both below; step through time and watch where they part.

Non-preemptive

Once a task starts, it runs to completion. Everyone else waits.

Preemptive

A newly released task with higher priority takes the processor at once.

t = 0

Non-preemptive

Preemptive

Task set

Examples
TaskReleaseExecution timePriorityDeadline
(after release)

Time is in whole units. Leave a deadline empty for none. Equal priorities are served in release order and do not preempt each other.

Response times

TaskDeadlineNon-preemptivePreemptive

Response time = finish time − release time.

What preemption buys. A high-priority task never waits for a lower-priority one, so its response time depends only on itself and the tasks above it.

What it costs. Each preemption is an extra context switch, and a task can be interrupted halfway through updating shared data, so shared resources need protecting.

Blocking without preemption. A task can be held up by at most one lower-priority task, for as long as that task still has to run. One long low-priority task is enough to break a tight deadline.