This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: why does rwlock prefer readers by default?


On Wed, 2014-05-07 at 13:25 +0200, OndÅej BÃlka wrote:
> On Wed, May 07, 2014 at 12:33:51PM +0200, Torvald Riegel wrote:
> > POSIX makes it an implementation-defined choice whether readers or
> > writers are preferred.  Our current implementation's default is that
> > readers are to be preferred.  I couldn't find the rationale for this;
> > does anybody know what it was?
> > 
> > Otherwise, if this was an arbitrary choice, what do you all think the
> > default should be?  Can we change it?  Should we change it to preferring
> > writers?
> 
> See archives, original thread was here
> 
> https://sourceware.org/ml/libc-alpha/2013-07/msg00232.html

I've read this thread ...

> This was recently pinged in this thread.
> 
> https://sourceware.org/ml/libc-alpha/2014-04/msg00049.html

... except this newer message.

> A relevant part from Wang's mail is following: "
> 
> Cyril Hrubis once reported a bug about pthread_rwlock() posix tests in
> LTP:
> https://sourceware.org/bugzilla/show_bug.cgi?id=13701
> 
> And there were some clarification requests for Austin Group about this
> issue.
> see:
> 
> http://austingroupbugs.net/view.php?id=720
> http://austingroupbugs.net/view.php?id=722
> 
> 
> According to the discussion results, it seems that write locks should be
> implemented to take precedence before the read locks.
> 
> "

I don't agree with that conclusion, but I'll reply regarding that on the
other thread.

Nonetheless, this thread above is about how to handle writer preference
in case some reader has currently acquired the lock.  There's still a
case separate for that where reader/writer preference matters.  Assume
that a writer holds the lock, and other writers are waiting to acquire
the lock as well.  Now a reader comes in; should the reader take
preference, or wait for all waiting writers to finish?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]