You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On macOS and iOS, as of last year or so, many kernel synchronization mechanisms support priority inheritance out of the box. (For a list of things that support it, see this header and scroll down a bit.) When using one of those mechanisms, a waiting thread knows which thread it's waiting for, and if the waiter has higher priority than the waitee, the kernel temporarily boosts the waitee's priority to match.
Priority inheritance is clearly useful across processes. One might think that it's not very useful within a single process, since it's rare for threads in the same process to be set at different priorities. But even if they're set at the same priority, they can have different effective priorities if one of them has been boosted by priority inheritance from another process. If that thread then tries to lock a mutex held by another thread, it should be able to pass on its boost to the latter thread. For this reason, the list of mechanisms supporting priority inheritance includes pthread mutexes (as well as ulocks, another kind of userland mutex).
As far as I can tell, parking_lot currently doesn't support priority inheritance on any platform; park has no way of notifying the kernel which thread it's waiting for. It would be good to fix this, though it might require substantial API changes.
The text was updated successfully, but these errors were encountered:
On macOS and iOS, as of last year or so, many kernel synchronization mechanisms support priority inheritance out of the box. (For a list of things that support it, see this header and scroll down a bit.) When using one of those mechanisms, a waiting thread knows which thread it's waiting for, and if the waiter has higher priority than the waitee, the kernel temporarily boosts the waitee's priority to match.
Priority inheritance is clearly useful across processes. One might think that it's not very useful within a single process, since it's rare for threads in the same process to be set at different priorities. But even if they're set at the same priority, they can have different effective priorities if one of them has been boosted by priority inheritance from another process. If that thread then tries to lock a mutex held by another thread, it should be able to pass on its boost to the latter thread. For this reason, the list of mechanisms supporting priority inheritance includes pthread mutexes (as well as ulocks, another kind of userland mutex).
As far as I can tell,
parking_lot
currently doesn't support priority inheritance on any platform;park
has no way of notifying the kernel which thread it's waiting for. It would be good to fix this, though it might require substantial API changes.The text was updated successfully, but these errors were encountered: