linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add the pthread_rwlock_unlock() different point explanation between Linux and POSIX
@ 2009-07-07  9:04 Zhang Xiliang
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang Xiliang @ 2009-07-07  9:04 UTC (permalink / raw)
  To: mtk-manpages-hi6Y0CQ0nG0, linux-man-u79uwXL29TY76Z2rM5mHXA

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] Add the pthread_rwlock_unlock() different point explanation between Linux and POSIX
@ 2009-07-20  1:52 Zhang Xiliang
       [not found] ` <4A63CDF9.6040603-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Xiliang @ 2009-07-20  1:52 UTC (permalink / raw)
  To: mtk-manpages-hi6Y0CQ0nG0, linux-man-u79uwXL29TY76Z2rM5mHXA

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add the pthread_rwlock_unlock() different point explanation between Linux and POSIX
       [not found] ` <4A63CDF9.6040603-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
@ 2009-10-09  6:59   ` Petr Baudis
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Baudis @ 2009-10-09  6:59 UTC (permalink / raw)
  To: Zhang Xiliang; +Cc: mtk-manpages-hi6Y0CQ0nG0, linux-man-u79uwXL29TY76Z2rM5mHXA

  Hi!

On Mon, Jul 20, 2009 at 09:52:57AM +0800, Zhang Xiliang wrote:
> 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>

  I wonder if there is some kind of policy about how to incorporate this
information; putting it in the POSIX manpages is probably unfeasible,
but maybe a nptl(7) man-page could be created, covering implementation
notes, and put in SEE ALSO section of all pthread manpages?

-- 
				Petr "Pasky" Baudis
A lot of people have my books on their bookshelves.
That's the problem, they need to read them. -- Don Knuth
--
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-09  6:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
2009-07-07  9:04 Zhang Xiliang

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).