linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhang Xiliang <zhangxiliang-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
To: mtk-manpages-hi6Y0CQ0nG0@public.gmane.org,
	linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] Add the pthread_rwlock_rdlock() different point explanation between Linux and POSIX
Date: Mon, 20 Jul 2009 09:51:56 +0800	[thread overview]
Message-ID: <4A63CDBC.4030102@cn.fujitsu.com> (raw)

I tested the scheduler of rwlock in Linux, and found that when write lock is blocked
(a read process has acquired read lock), the other read process can acquire
read lock again.

A read process                       <--acquired read lock
  ->A write process                  <--block for the reading process unlock
    ->The other read process         <--it acquired read lock again
      ->The write process            <--block for the two reading process unlock

In pthread_rwlock_rdlock() manual, the other read process should be blocked when 
a write process blocked. Write locks shall take precedence over read locks by
default.

The diffrent point between Linux and POSIX should be listed in linux-glibc man page.

Signed-off-by: Zhang Xiliang <zhangxiliang-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
---
 man3p/pthread_rwlock_rdlock.3p |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/man3p/pthread_rwlock_rdlock.3p b/man3p/pthread_rwlock_rdlock.3p
index b63adbf..6e471d8 100644
--- a/man3p/pthread_rwlock_rdlock.3p
+++ b/man3p/pthread_rwlock_rdlock.3p
@@ -77,6 +77,12 @@ If a signal is delivered to a thread waiting for a read-write lock
 for reading, upon return from the signal handler the thread
 resumes waiting for the read-write lock for reading as if it was not
 interrupted.
+.SH DIFFERENCE BETWEEN LINUX and POSIX
+.LP
+In linux, when the threads involved in the lock are executing with 
+the scheduling policies SCHED_FIFO or SCHED_RR, if a reader holds the 
+lock and writers of higher or equal priority are blocked on the lock, 
+the other readers also hold the lock by default.
 .SH RETURN VALUE
 .LP
 If successful, the \fIpthread_rwlock_rdlock\fP() function shall return


--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2009-07-20  1:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-20  1:51 Zhang Xiliang [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-07-07  9:04 [PATCH] Add the pthread_rwlock_rdlock() different point explanation between Linux and POSIX Zhang Xiliang

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=4A63CDBC.4030102@cn.fujitsu.com \
    --to=zhangxiliang-bthxqxjhjhxqfuhtdcdx3a@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk-manpages-hi6Y0CQ0nG0@public.gmane.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 NNTP newsgroup(s).