
Priority inversion is a phenomenon that can occur in real-time systems when a higher-priority task is blocked or delayed by a lower-priority task due to resource contention. In such cases, the higher-priority task may have to wait for access to shared resources, like critical data or hardware, which are currently being used by a lower-priority task. As a result, the higher-priority task may not meet its deadlines, leading to potential system failures or degraded performance.
On Mars Rover Pathfinder, The meteorological data gathering task ran as an infrequent, low priority thread, and used the information bus to publish its data. When publishing its data, it would acquire a mutex, do writes to the bus, and release the mutex. If an interrupt caused the information bus thread to be scheduled while this mutex was held, and if the information bus thread then attempted to acquire this same mutex in order to retrieve published data, this would cause it to block on the mutex, waiting until the meteorological thread released the mutex before it could continue. The spacecraft also contained a communications task that ran with medium priority.
Upon landing, a particular instance in the scheduling occurred where a priority inversion happened, with a lower priority task holding a resource required by the higher priority which forced a reset when it could not complete this loop repeated what seemed to be indefinitely.
The fix, the “priority inheritance” parameter of the semaphore for the meteorological data thread was not enabled in Pathfinder’s VxWorks software. If priority inheritance had been enabled, “the low priority meteorological thread would have inherited the priority of the high-priority data bus thread blocked on it while it held the mutex, causing it be scheduled with higher priority than the medium-priority communications task, thus preventing the priority inversion.” and then “changed the creation flags for the semaphore so as to enable the priority inheritance.”
To prevent priority inversion, RTOS and software architectures in space missions typically use priority-based scheduling algorithms, priority inheritance protocols, or priority ceiling protocols. These mechanisms help ensure that higher-priority tasks have priority over lower-priority tasks when accessing shared resources, reducing the risk of priority inversion.
An mail that explains everything: http://eos.cs.ovgu.de/eos_old/lehre/WS0708/vl_pkes/folien/risk.pathfinder.pdf
A detailed study: https://www.cse.chalmers.se/~risat/Report_MarsPathFinder.pdf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An Article by: Yashwanth Naidu Tikkisetty
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
