cvs commit: src/sys/conf files src/sys/kern kern_mutex.c kern_thread.c subr_turnstile.c subr_witness.c src/sys/sys _mutex.h filedesc.h proc.h

David Schultz das at FreeBSD.ORG
Tue Nov 11 22:09:20 PST 2003


On Tue, Nov 11, 2003, John Baldwin wrote:
> jhb         2003/11/11 14:07:30 PST
> 
>   FreeBSD src repository
> 
>   Modified files:
>     sys/conf             files 
>     sys/kern             kern_mutex.c kern_thread.c 
>                          subr_turnstile.c subr_witness.c 
>     sys/sys              _mutex.h filedesc.h proc.h 
>   Log:
>   Add an implementation of turnstiles and change the sleep mutex code to use
>   turnstiles to implement blocking isntead of implementing a thread queue
>   directly.  These turnstiles are somewhat similar to those used in Solaris 7
>   as described in Solaris Internals but are also different.

Very nice!

> + * Each time a thread is created, a turnstile is malloc'd and attached to
> + * that thread.  When a thread blocks on a lock, if it is the first thread
> + * to block, it lends its turnstile to the lock.  If the lock already has
> + * a turnstile, then it gives its turnstile to the lock's turnstile's free
> + * list.  When a thread is woken up, it takes a thread from the free list
						   ^^^^^^ turnstile?

> + * if there are any other waiters.  If it is the only thread blocked on the
> + * lock, then it reclaims the turnstile associated with the lock and removes
> + * it from the hash table.


More information about the cvs-src mailing list