Skip to contentSkip to conversation

Add the pthread_rwlock_unlock() different point explanation between Linux and POSIX

PATCH In review Zhang Xiliang 2 participants 2 messages Jul 20, 2009 – Oct 9, 2009 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add the pthread_rwlock_unlock() different point explanation between Linux and POSIX

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.

---
 man3p/pthread_rwlock_unlock.3p |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
man3p/pthread_rwlock_unlock.3p +5 -0
index 3e726d0..4508536 100644
@@ -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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi!

Quoted 8 lines · Zhang Xiliang

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
Quoted 6 lines

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.

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?

Signature · 7 lines
				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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html