Priority inheritance – avoiding priority inversion

Okay, great; but how does one fix such an issue as priority inversion? Interestingly, this is a known risk, and the design of the mutex includes a built-in solution. Two mutex attributes exist with regard to helping address the priority inversion issue—priority inheritance (PI) and priority ceiling.

PI is an interesting solution. Think about it, the key issue is the way in which the OS schedules threads. In an OS (and especially on an RTOS), the scheduling of a real-time thread—deciding who runs—is essentially directly proportional to the priority of the competing threads: the higher your priority, the better the chance you will run. So, let's take a quick relook at our preceding scenario ...

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.