This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about Thread Execution Scheduling of pthread rwlock


Could anyone give some comments about it? Thanks.

On the POSIX spec pthread_rwlock_rdlock() section about tps:

If the Thread Execution Scheduling option is supported, and the
threads involved in the lock are
executing with the scheduling policies SCHED_FIFO or SCHED_RR, the
calling thread shall not
acquire the lock if a writer holds the lock or if writers of higher or
equal priority are blocked on
the lock; otherwise, the calling thread shall acquire the lock.

But the glibc/eglibc's implement doesn't care the the priority, and
just provides a rwlock->__data.__flags flag to
identify perfer 'read lock' or write lock.

By default when a rwlock has read locked on a critical region, then a
rwlock trys to write locked on the critical region
then it will be blocked. At this time another rwlock try to read lock
the region it will get the critical region.
So this breaks the POSIX spec.

Why does glibc/eglibc deal rwlock in this way? Does that because they
don't support "Thread Execution Scheduling option"?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]