Re:Proposed futex2 allows Linux to mimic the NT kernel for b...
by xxs on Wednesday April 28, 2021 @02:03PM
(#26972226)
>"context switch to and from the kernel"
This is a common misconception, a "context" switch is a lot more expensive than a "mode" switch that goes from user mode to the kernel mode (and back).
Of course, if the futex has to wait, it'd be a context switch for real.
Re:Proposed futex2 allows Linux to mimic the NT kernel for b...
by ece on Wednesday April 28, 2021 @06:55PM
(#26975293)
ESYNC is the way this is currently done, it's hit and miss in that it doesn't work unless the number of open files is set high enough for some games. It's also slower than this proposal.
Afaik, if locking a mutex succeeds, futexes avoid a context switch to and from the kernel. The fast path happens completely in userspace. Only when a mutex lock causes a thread to sleep, the kernel is needed. All of this improves mutex performance.
There are other locking primitives than mutexes, and the current futex interface is not optimal for implementing common windows ones. Hence this proposal.