Starvation is when a task never gets to run because higher-priority tasks monopolize the CPU. Under preemptive priority scheduling, the highest-priority Ready task always runs, so if a high-priority task stays Ready indefinitely, because it busy-loops, never blocks, or simply has more work than the CPU can do while leaving slack, then every lower-priority task, down to the idle task, is locked out forever. The symptoms are lower-priority work that mysteriously never executes, no low-power idle, and possibly a watchdog that never gets kicked. Prevention is primarily good design: high-priority tasks should do minimal work and then block to wait for their next trigger (a semaphore from an ISR, a queue item, a delay), so they only consume CPU when there's genuinely urgent work, leaving the rest of the time for lower-priority tasks; you also ensure the overall CPU utilization is below 100% with margin so the schedule is feasible (the schedulability concern from the real-time lesson). You assign priorities by deadline urgency rather than importance-in-the-abstract, avoid long computations in high-priority tasks (break them up or move them down), and verify with run-time stats that lower-priority tasks and idle actually run. Note that classic priority scheduling has no built-in anti-starvation aging (unlike some general-purpose OS schedulers), so on an RTOS it's on you to design the workload to be schedulable.
RTOS & Real-Time Concepts · Interview question
What is starvation and how do you prevent it?
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
What's the difference between preemptive and cooperative scheduling?Two tasks have the same priority and both are ready. What happens?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