Priority inversion

Let's visualize an application that contains three threads; one of them is a high priority thread (let's calls it thread A with priority 90), the other is a low priority thread (let's calls it thread B with priority 10) and finally a medium priority thread, C. (The priority range for the SCHED_FIFO scheduling policy is 1 to 99, with 99 being the highest possible priority; more on this in a later chapter.) So, we can imagine that we have these three threads within a process at differing priorities:

  • Thread A: high priority, 90
  • Thread B: low priority, 10
  • Thread C: medium priority, 45

Furthermore, let's consider that we have some shared resource, X, which is coveted by threads A and B; this, of course, constitutes a critical ...

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.