scheduler (sched_4bsd) questions
John Baldwin
jhb at FreeBSD.org
Mon Oct 4 08:33:31 PDT 2004
On Friday 01 October 2004 12:13 am, Stephan Uphoff wrote:
> On Wed, 2004-09-29 at 18:14, Stephan Uphoff wrote:
> > I was looking at the MUTEX_WAKE_ALL undefined case when I used the
> > critical section for turnstile_claim().
> > However there are bigger problems with MUTEX_WAKE_ALL undefined
> > so you are right - the critical section for turnstile_claim is pretty
> > useless.
>
> Arghhh !!!
>
> MUTEX_WAKE_ALL is NOT an option in GENERIC.
> I recall verifying that it is defined twice. Guess I must have looked at
> the wrong source tree :-(
> This means yes - we have bigger problems!
>
> Example:
>
> Thread A holds a mutex x contested by Thread B and C and has priority
> pri(A).
>
> Thread C holds a mutex y and pri(B) < pri(C)
>
> Thread A releases the lock wakes thread B but lets C on the turnstile
> wait queue.
>
> An interrupt thread I tries to lock mutex y owned by C.
>
> However priority inheritance does not work since B needs to run first to
> take ownership of the lock.
>
> I is blocked :-(
Ermm, if the interrupt happens after x is released then I's priority should
propagate from I to C to B. If the interrupt happens before x is released,
then the final bit of propagate_priority() should handle it since it resorts
the turnstile's thread queue so that C will be awakened rather than B.
--
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the freebsd-arch
mailing list