All of lore.kernel.org
 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_unlock() different point explanation between Linux and POSIX
Date: Tue, 07 Jul 2009 17:04:32 +0800	[thread overview]
Message-ID: <4A530FA0.7030505@cn.fujitsu.com> (raw)

I tested the unlock order of rwlock in Linux with SCHED_FIFO and SCHED_RR, and found 
that when readers blocked has higher priority than writers, writers always shall 
take precedence over readers.

A write process                         <--unlock the rwlock
  ->A higher priority read process      <--block
  ->A lower priority write process      <--acquired rwlock

In pthread_rwlock_rdlock() manual, it says: If the Thread Execution Scheduling option is
supported, when threads executing with the scheduling policies SCHED_FIFO, SCHED_RR, or 
SCHED_SPORADIC are waiting on the lock, they shall acquire the lock in priority order
when the lock becomes available.

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

diff --git a/man3p/pthread_rwlock_unlock.3p b/man3p/pthread_rwlock_unlock.3p
index 3e726d0..4508536 100644
--- a/man3p/pthread_rwlock_unlock.3p
+++ b/man3p/pthread_rwlock_unlock.3p
@@ -49,6 +49,11 @@ locks.
 .LP
 Results are undefined if any of these functions are called with an
 uninitialized read-write lock.
+.SH DIFFERENCE BETWEEN LINUX and POSIX
+.LP
+In Linux, when threads executing with the scheduling policies SCHED_FIFO, 
+SCHED_RR are waiting on the block, write locks always shall take precedence 
+over read lockswhich have higher priority.
 .SH RETURN VALUE
 .LP
 If successful, the \fIpthread_rwlock_unlock\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-07  9:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-07  9:04 Zhang Xiliang [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-07-20  1:52 [PATCH] Add the pthread_rwlock_unlock() different point explanation between Linux and POSIX Zhang Xiliang
     [not found] ` <4A63CDF9.6040603-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-10-09  6:59   ` Petr Baudis

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=4A530FA0.7030505@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.