Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Mar 2003 14:23:17 -0500 (EST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        David Xu <davidxu@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org, cvs-src@FreeBSD.org, src-committers@FreeBSD.org
Subject:   RE: cvs commit: src/lib/libpthread/thread thr_rwlock.c
Message-ID:  <XFMail.20030314142317.jhb@FreeBSD.org>
In-Reply-To: <200303140102.h2E12lxt019206@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 14-Mar-2003 David Xu wrote:
> davidxu     2003/03/13 17:02:47 PST
> 
>   FreeBSD src repository
> 
>   Modified files:
>     lib/libpthread/thread thr_rwlock.c 
>   Log:
>   Fix a bug in rwlock. When a rwlock was locked by reader threads, a
>   writter thread can block reader threads to get read lock.

That's not a bug.  That is a very common way of implementing reader
writer locks.  The idea is that if a writer is waiting for the lock
you make later read requests wait for the lock so that they don't
starve the writer.  This is how Solaris rw locks work for example.
The in-kernel sx locks don't currently work that way, but that
may change at some point in the future.  For more discussion on why
Solaris chose this route, go find a copy of Solaris Internals.

You probably should revert this and find out if this was an
intentional design decision rather than a "bug".

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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