0

I have been working with posix threads and mutex since last few years but was not aware of concept of mutex ownership and user. When exploring this document about Priority inheritance and Priority ceiling in posix, the Note section of page put a doubt in me regarding ownership and user :

Note: The behavior of PTHREAD_PRIO_DEFAULT is the same as the PTHREAD_PRIO_INHERIT attribute. With reference to the mutex locking, the threads acting with the default attribute will temporarily boost the priority of a mutex holder when a user is locked and has a higher priority than the owner. Therefore, there are only three behaviors that are possible, although there are four values for the possible priority in the attribute structure.

  • By a "user is locked" they probably mean a thread which is locked in the call to `pthread_mutex_lock`. BTW, the constant `PTHREAD_PRIO_INHERIT` is defined in the above table as "Denotes the priority inheritance protocol.", so why don't read the description of that protocol? "In the priority inheritance protocol, the mutex holder inherits the priority of the highest-priority blocked thread. When a thread tries to lock a mutex using this protocol and is blocked, the mutex owner temporarily receives the blocked thread's priority, if that priority is higher than the owner's." – Tsyvarev Mar 26 '23 at 09:04

0 Answers0