In preemptive scheduling the kernel can forcibly take the CPU away from a running task at any point, typically the moment a higher-priority task becomes Ready (or, among equals, when a time slice expires), so a running task can be interrupted mid-function and switched out. In cooperative scheduling the running task keeps the CPU until it voluntarily gives it up by blocking or explicitly yielding; the kernel never forcibly preempts. The tradeoff is responsiveness versus simplicity. Preemptive guarantees an urgent task runs within a context switch regardless of what was running, which is essential for meeting tight deadlines, but it means any data shared between tasks can be interrupted mid-update, so you need mutexes/critical sections. Cooperative makes shared data implicitly safe between yield points (a task can't be interrupted by another task while it isn't yielding), simplifying synchronization, but it's only as responsive as the worst-behaved task, one task that fails to yield hangs the entire system, and no high-priority task can preempt to meet a deadline. So preemptive is the default for real-time responsiveness; cooperative is a disciplined, simpler model viable only when you trust every task's yield behavior.
RTOS & Real-Time Concepts · Interview question
What's the difference between preemptive and cooperative scheduling?
A strong answer
What a weak answer sounds like
You know the answer. Do you know what gets you dinged?
Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.
From the lesson
Preemptive vs Round-Robin Scheduling
How the scheduler chooses: priority preemption (urgent runs first), round-robin time-slicing among equal priorities, and cooperative scheduling, plus the starvation and fairness tradeoffs.
More Preemptive vs Round-Robin Scheduling questions
Two tasks have the same priority and both are ready. What happens?What is starvation and how do you prevent it?How does FreeRTOS combine priority and round-robin scheduling?When is cooperative scheduling actually a good choice?When a higher-priority task becomes Ready, what actually happens at the hardware level to switch to it on a Cortex-M?Under preemptive priority scheduling, can a high-priority task ever be blocked by a low-priority one?
Browse all 472 interview questions