On 4 July 1997, the Mars Pathfinder rover landed on the Red Planet and began sending home data. Then it started rebooting itself — repeatedly, unexpectedly, millions of kilometres from the nearest repair shop. Engineers had to diagnose the fault from Earth and patch the software remotely. The culprit: priority inversion.
Priority inversion is a scheduling anomaly that sounds impossible at first: a high-priority task is blocked waiting for a low-priority task to release a shared resource — a mutex, a semaphore, a hardware register. While the low-priority task dithers, a medium-priority task swoops in, preempts the low one, and keeps running. Now the high-priority task is not merely waiting for a lock — it is waiting for every medium-priority task in the system to finish first.
The scheduler is doing exactly what it was told: always run the highest-priority runnable task. But "runnable" is the key word. The high-priority task is not runnable — it is blocked. The lock is the invisible chain, and the medium-priority task is holding it taut, completely unaware.
This is not a theoretical curiosity. It has crashed flight software, caused real-time guarantees to be violated, and inspired one of the most elegant fixes in operating-systems design: priority inheritance.
Comments
Loading comments...