Re: pthread_mutex_unlock (was Re: sched_yield() makes OpenLDAP slow)

From: Helge Hafting
Date: Mon Jan 30 2006 - 03:31:54 EST


David Schwartz wrote:

Third, there's the ambiguity of the standard. It says the "sceduling
policy" shall decide, not that the scheduler shall decide. If the policy is
to make a conditional or delayed decision, that is still perfectly valid
policy. "Whichever thread requests it first" is a valid scheduler policy.


Sure. And with a "whichever thread aquires it first" policy, then
it is obvious what happens when a mutex is released when someone
is blocked on it: Whoever blocked on it first is then the one
who requested it first - that cannot change as the request was made
before the mutex even was released. So then, the releasing thread has
no chance of getting the mutex back until the others have had a
go at it - no matter what threads actually gets scheduled.

Helge Hafting

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/