Keil Logo

Priority Inversion

The RTX Real Time Operating system employs a priority-based preemptive scheduler. The RTX scheduler assings each task a unique priority level. The scheduler ensures that of those tasks that are ready to run, the one with the highest priority is always the task that is actually running.

Because tasks share resourcs, events outside the scheduler's control can prevent the highest priority ready task from running when it should. If this happens, a critical deadline could be missed, causing the system to fail. Priority inversion is the term of a scenario in which the highest-priority ready task fails to run when it should.

Resource sharing

Tasks need to share resources to communicate and process data. Any time two or more tasks share a recource, such as a memory buffer or a serial port, one of them will usually have a higher priority. The higher-priority task expects to be run as soon as it is ready. However, if the lower-priority task is using their shared resource when the higher-priority task becomes ready to run, the higher-priority task must wait for the lower-priority task to finish with it.

Priority inheritance

To prevent priority inversions, the RTX Real Time OS employs a Priority inheritance method. The lower-priority task inherit the priority of any higher-priority task pending on a resource they share. For a short time, the lower-priority task runs at a priority of a higher-priority pending task. The priority change takes place as soon as the high-priority task begins to pend. When the lower-priority task stops using a shared resource, it's priority level returns to normal.

The RTX mutex objects (Mutual Exclusive Lock objects) employ the Priority inheritance.

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.