RTOS & Real-Time Concepts · Interview question

Explain priority inversion with a concrete scenario.

A strong answer

Priority inversion is when a high-priority task is blocked waiting on a resource held by a lower-priority task, so it can't run even though it outranks everything ready. The concrete three-task scenario: a Low-priority task takes a mutex and enters its critical section. A High-priority task becomes ready, tries to take the same mutex, and blocks because Low holds it, that much is normal and unavoidable. The problem appears when a Medium-priority task (which doesn't use the mutex) becomes ready: because Medium outranks Low, it preempts Low and runs its own unrelated work. Now High is waiting for Low to release the mutex, but Low can't make progress because Medium has the CPU, so the highest-priority task is effectively blocked by a medium-priority task it outranks, with the priorities inverted. The severity is that as long as medium-priority tasks keep running, High remains blocked indefinitely, blowing its deadline. The distinction that matters is bounded versus unbounded: waiting for Low to finish its critical section is bounded and acceptable; the unbounded extension by arbitrary medium-priority work is the dangerous part.

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

Priority Inversion

When a high-priority task is stuck behind a low-priority one, and a medium task makes it unbounded. The classic Mars Pathfinder bug, and the fix: priority inheritance (and ceilings).

More Priority Inversion questions

Browse all 472 interview questions
Explain priority inversion with a concrete scenario. | EmbeddedPrep.io