[Techtalk] Priority inheritance

Val Henson val at nmt.edu
Wed Jan 16 15:33:43 EST 2002

On Tue, Jan 15, 2002 at 08:54:54PM -0500, Raven, corporate courtesan wrote:
> 	But surely you can't just do that, because processes on that
> list may be wanting to do other things than return their resources.  You
> wouldn't want to pass a Platinum priority down to some scummy little
> Silver that's just going to be asking for more resources anyway.  [grin]

Vahalia had something to say about this... Let's see:

"Priority inheritance can only be implemented in situations where we
know which thread is going to free the resource." (p. 137, "UNIX

Implicitly, we're also assuming that the resource will be freed by
somebody sometime.  All of the questions you've raised are very good
ones and they are part of the reason why most (but not all) operating
systems developers feel mildly nauseated when they think about
priority inheritance. :)

> 	So how is it that determining what each process wants is done?
> I'm assuming that the broadcast protocol is the tool of choice, but how
> does it keep track of things, mechanistically?

Here's one way to do it: Each object has a pointer to its owner.  When
a process blocks on that object, it follows that pointer to its owner
and wills its priority to the object's owner.  Then you check to see
if the owner is blocked on any other object (requiring more pointers)
and repeat the process until you get to an unblocked process or to a
process with a priority >= your own.

> 	(Or do processes generally work more efficiently than that?  If
> they free up $50, do they keep it and try to reuse it themselves, or do
> they release it back to the OS when they can and then request what they
> need?  Or does it depend on the process?  If that, which way is
> optimal?)

The answer is: it depends.  Which is optimal?  It depends. :)

Operating systems are cool partly because there are so few actual
answers.  Most of the time, the only way to answer a question is to
implement something and see what happens.

Most people would say that a preemptive kernel with priority
inheritance is only suitable for a very simple realtime application
with very few processes.  You need to think very carefully about
how shared resources are going to be shared and how you are going to
maintain your realtime response constraints.  The complexity very
quickly becomes more than a human brain can handle.


More information about the Techtalk mailing list