Date: Thu, 15 Dec 2005 10:17:11 -0500 From: John Baldwin <jhb@freebsd.org> To: freebsd-hackers@freebsd.org Cc: prime <guomingyan@gmail.com> Subject: Re: Use turnstile to implement sx_lock Message-ID: <200512151017.12168.jhb@freebsd.org> In-Reply-To: <1fa17f810512150652h5da6a6a5g3347f841a614689e@mail.gmail.com> References: <1fa17f810512150652h5da6a6a5g3347f841a614689e@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 15 December 2005 09:52 am, prime wrote: > hi hackers, > I want to use turnstile to implement sx_lock( or read/write lock),but > find that there is a big obstacle, > ONE sx_lock needs TWO queues to put waiters on,one for readers and the > other one for writers,but ONE turnstile can only supply ONE queue,and ONE > sx_lock can only get ONE turnstile. > > I read opensolaris' rw_lock implementation and find that its turnstile > has TWO queues which is different from FreeBSD's turnstile. > > Are there any good ideas to bypass the obstacle? Thanks very much. You have to add a second queue to the turnstile and make priority propagation still work, etc. Mutexes would just use the exclusive queue all the time whereas rwlocks would use both queues. This is the hard part of the rwlock project. I've sort-of started on this but haven't gotten very far at all in my jhb_lock p4 branch. -- John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512151017.12168.jhb>