How did a low-priority task freeze a spacecraft on Mars?
Days after Mars Pathfinder landed, its computer kept rebooting. The cause was a humble background job that blocked the most important one.
▶ Start the storyA low-priority task froze a spacecraft on Mars because it held something an important task needed, while busier medium-priority tasks kept the low-priority one from finishing. This is called priority inversion, and it happened to Mars Pathfinder, which landed on 4 July 1997.
Priority inversion is a scenario in which a high-priority task is indirectly held up by a lower-priority one, so that the priorities are effectively turned upside down. Here is how. Call the important task H and a humble one L. If H needs a resource that L has already taken, H must wait until L lets go. Normally that is short. But a third task, M, of medium priority, can then preempt L, since M does not need the resource. L cannot finish and release it, so H, the most important task, cannot run.
Step 1: L holds a resource
A low-priority task takes the
Step 2: H must wait
The high-priority task needs it and is blocked
Step 3: M L
A medium task runs instead, so L cannot finish
Step 4: Deadline missed
H, the most important task, never gets to run
On Mars the same thing happened. A much lower-priority weather-instrument task held a , and several medium-priority tasks preempted it. The high-priority data-handling task then blocked waiting for that resource and missed its deadline. The spacecraft is designed to react to a missed deadline by resetting its computer, and so it did. A lost no data already collected, but the rest of that day's activities waited until the next day.
The fix was one small setting, : a low-priority task holding a resource temporarily takes the priority of the highest-priority task waiting for it. Engineers sent a patch to Mars on 21 July.
Quiz me
0/3
Recap
Priority inheritance fixes inversion: the task holding the lock borrows the priority of the one waiting.
💡 A trick to remember it · A big kid stuck behind a tiny kid tying a shoe while medium kids keep cutting in: let the tiny kid borrow the big kid's place.
Surprising fact · Pathfinder's engineers had seen the bug before launch but ranked it low priority.
Sources (4)
No source, no claim. Every fact in this lesson (17 claims) cites at least one of these.