pthread_{mutex,cond} & fifo/starvation/scheduling policy

Daniel Eischen deischen at freebsd.org
Thu Jan 21 10:31:28 UTC 2010


On Thu, 21 Jan 2010, Bernard van Gastel wrote:

> But the descheduling of threads if the mutex is not available is done 
> by the library. And especially the order of rescheduling of the 
> threads (thats what I'm interested in). Or am I missing something in 
> the sys/kern/sched files (btw I don't have the umtx file).

No, it's done by the kernel.  Threads block on a umtx in
the kernel, and they are also woken up by the kernel.  The
threads library does not wake up a specific thread - it
just calls into the kernel to unlock the umtx and the
kernel decides which thread to wake up.  You should probably
see src/sys/kern/kern_umtx.c.

-- 
DE


More information about the freebsd-hackers mailing list