Futex
Fast Userspace Mutual Exclusive is a kernel feature that helps userspace applications to build MUTEX solutions by sleeping and waking up threads based on the state of the lock.
- An application thread calls Futex to remove itself out of scheduling until another thread releases the lock.
- Futex holds an hash map of memory addresses and blocked threads.
- When a second thread which was actually holding the lock updates the memory address value as free, it also calls the Futex with a WAKE_UP command for that specific address.
- Futex then wakes up all threads which were blocked before.
All programming languages use this feature internally to provide locking and synchronization features.
Lock address
This can be any address that's related to the application. For example, it can be the address of a lock property of the object.
