3 ms·
Futex stands for fast userspace mutex. It is a basic building block for implementing a mutex (amongst others). Afaik, if locking a mutex succeeds, futexes avo
by hyperman1 6y ago
Futex stands for fast userspace mutex. It is a basic building block for implementing a mutex (amongst others).
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.
- xxs 6y ago>"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.
- ece 6y agoESYNC 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.
- deleted 6y ago[deleted]