public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "triegel at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug nptl/14958] Concurrent reader deadlock in pthread_rwlock_rdlock()
Date: Tue, 28 Apr 2015 21:39:00 -0000	[thread overview]
Message-ID: <bug-14958-131-J4HRnn8p5i@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-14958-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=14958

Torvald Riegel <triegel at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |ASSIGNED
                 CC|                            |triegel at redhat dot com

--- Comment #7 from Torvald Riegel <triegel at redhat dot com> ---
I think it is, strictly speaking, debatable whether the test case (and
underlying assumption about the required behavior) is correct.  If Thread
Execution Scheduling were not supported, the behavior is
implementation-defined:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html

glibc claims it does support it, but the testcase does not explicitly set a
scheduling policy; I would read the POSIX spec as still allowing
implementation-defined behavior in this case.  Nonetheless, given that the
current rwlock implementation ignores the priorities (see bug 13701) and tries
to prefer readers (unless PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP),
it seems better to support this test case.  For a reader-preferring
implementation, it seems intuitive for programmers to expect that if one thread
has acquired a read lock, another thread will acquire a read lock eventually as
well, even in the case of concurrent writer acquisition attempts.

Recursive read-locks are allowed too for the default rwlock type, which would
be similar in that concurrent writers cannot block readers (this is already
treated correctly by the implementation).

Therefore, I think supporting this use case makes sense even if not strictly
required.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


  parent reply	other threads:[~2015-04-28 21:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-13 20:55 [Bug libc/14958] New: " daniel.stodden at gmail dot com
2012-12-13 23:22 ` [Bug libc/14958] " daniel.stodden at gmail dot com
2012-12-13 23:59 ` daniel.stodden at gmail dot com
2012-12-15  5:16 ` bugdal at aerifal dot cx
2012-12-16  9:12 ` daniel.stodden at gmail dot com
2012-12-16 17:33 ` bugdal at aerifal dot cx
2012-12-17  9:20 ` daniel.stodden at gmail dot com
2013-10-20 19:22 ` neleai at seznam dot cz
2014-02-07  3:17 ` [Bug nptl/14958] " jsm28 at gcc dot gnu.org
2014-06-14  5:35 ` fweimer at redhat dot com
2015-04-28 21:39 ` triegel at redhat dot com [this message]
2015-06-04 16:03 ` cvs-commit at gcc dot gnu.org
2015-06-04 16:07 ` triegel at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-14958-131-J4HRnn8p5i@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).