[Techtalk] Priority inheritance

Jeff Dike jdike at karaya.com
Fri Jan 18 00:33:36 EST 2002


raven at oneeyedcrow.net said:
> 	Okay, I'm game.  What are those, and how do they work?  

Actually, I wasn't quite right.  The bank analogy was breaking down because
of the things that need protecting by locks, not the locks themselves.

When a Platinum customer needs $100 and there are Silver customers depositing
$100 bills, it doesn't matter which of them you give priority to.  Any will
do.  

The only kernel resource that has this property that I can think of offhand
is memory.  When one process needs a page of memory and is sleeping until
one becomes available, any process that is willing to free a page can wake
it up and let it run again.

However, you can ask the customers in the Silver line who has $100 bills
to deposit and give them priority.  You can't do the same for processes
and ask them who is about to free a page of memory because they just don't
know.

Also, if there are two Silver customers wanting to deposit $50 each, you
can give them both priority, combine the deposits, and hand the $100 to
the Platinum customer.

You can't do the same for memory.  You can't take two newly freed half-pages,
glom them together into a full page, and hand it over to the process needing
a page.

There are resources where you can identify the process that will free them
and give it priority.  However, those are one of a kind resources, such
as a particular data structure.

The bank analogy breaks down here because money is fungible.  A better
analogy might be a library.  It has one copy of a particular book and
a Platinum member wants to check it out.  However, it is currently signed
out by a Silver member who happens to be in line.  So, you'd ask who has
that particular book, bring that person to the front of the line, and hand
it over to the Platinum member.

				Jeff




More information about the Techtalk mailing list