Skip to content

Test: Priority Inversion

Real-Time Systems

Priority Inversion: The Mars Pathfinder Resets

Mission briefing

On 4 July 1997, NASA’s Pathfinder lander touched down on Mars. Within days it began resetting itself, losing data each time. Every task worked correctly on its own. The problem was how three tasks shared one resource: the information bus, protected by a mutex so that only one task can use it at a time.

What the priority numbers mean

Every task has a priority, and the scheduler always runs the highest-priority task that is ready. The moment a more important task becomes ready, it preempts (interrupts) whatever is running. In this lab a higher number means a higher priority, so 3 is the highest and 1 is the lowest. Priorities follow urgency: the task whose lateness does the most damage gets the highest number.

Not every system counts this way. VxWorks, the real-time operating system on Pathfinder, uses 0 as its highest priority, so always check which direction your RTOS counts.

Bus manager · priority 3, highest

Moves data around the information bus. Must finish every cycle, or the watchdog assumes the lander has hung.

Highest, because it is the most time-critical. If it misses a cycle, the watchdog resets the whole lander.

Comms · priority 2, middle

Handles communications. Long-running, and never touches the bus.

In the middle. Communications matter, but finishing a few ticks late does no real harm.

Weather · priority 1, lowest

Gathers meteorological data and occasionally publishes it to the bus.

Lowest, because weather readings can wait. Nothing breaks if a measurement is taken a little late.

Speed
Tick
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Bus manager
priority 3, highest
Comms
priority 2, middle
Weather
priority 1, lowest
runningrunning, holding the busready, waiting for the processorblocked, waiting for the bus3raised prioritywatchdog deadline

Nothing has happened yet. Each column of the timeline is one scheduler tick. Press Play, or Step to move one tick at a time.

Tutor

Simulated: scripted replies driven by the live simulation

I am your tutor for this lab. I will mostly ask questions rather than hand you answers. Meet the three tasks below, then start the first sol.