Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Nov 2003 22:07:53 -0800
From:      David Schultz <das@FreeBSD.ORG>
To:        John Baldwin <jhb@FreeBSD.ORG>
Cc:        cvs-all@FreeBSD.ORG
Subject:   Re: 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
Message-ID:  <20031112060753.GA25471@VARK.homeunix.com>
In-Reply-To: <200311112207.hABM7UAu006144@repoman.freebsd.org>
References:  <200311112207.hABM7UAu006144@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031112060753.GA25471>