Add the pthread_rwlock_unlock() different point explanation between Linux and POSIX
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
@@ -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