Priority inheritance


I would like to now if there is a library that implements priority
inheritance in Ruby.

I now that some people thing that you are already in trouble if you need
to use this approach. But I really need to.

A little about priority inheritance:

"Imagine a system with two processes running, one at high priority and
the other at a much lower priority. These processes share resources
which are protected by locks. At some point, the low-priority process
manages to run and obtains a lock for one of those resources. If the
high-priority process then attempts to obtain the same lock, it will
have to wait. Essentially, the low-priority process has trumped the
high-priority process, at least for as long as it holds the contended

Now imagine a third process, one which uses a lot of processor time, and
which has a priority between the other two. If that process starts to
crank, it will push the low-priority process out of the CPU
indefinitely. As a result, the third process can keep the
highest-priority process out of the CPU indefinitely.

This situation, called “priority inversion,” tends to be followed by
system failure, upset users, and unemployed engineers. There are a
number of approaches to avoiding priority inversion, including lockless
designs, carefully thought-out locking scenarios, and a technique known
as priority inheritance. The priority inheritance method is simple in
concept: when a process holds a lock, it should run at (at least) the
priority of the highest-priority process waiting for the lock. When a
lock is taken by a low-priority process, the priority of that process
might need to be boosted until the lock is released." [1]

More references about PI:


Thanks in advance,

Daniel Cunha