◄ Wiki / OS
mutex
A lock that lets only one thread into a protected section at a time, putting others to sleep while they wait.
A mutex (mutual-exclusion lock) guards a critical section so just one thread runs it at once. Unlike a spinlock, which keeps a waiting thread spinning and burning a CPU core, a blocking mutex puts waiters to sleep and wakes them when the lock frees — better when the wait might be long. It's a fundamental tool for keeping shared data consistent.
See also
- mutual exclusionThe guarantee that only one thread or CPU is inside a given critical section at any moment.
- per-CPU stateData kept in a separate copy for each processor core, so cores don't step on each other.