Intuition
It is a one-person-at-a-time sign for shared data.
Technical definition
A mutex provides mutual exclusion by requiring acquisition before accessing protected shared state and release afterward.
Example
Two threads updating the same counter can use a mutex to prevent lost updates.
Common misunderstandings
- A mutex prevents simultaneous access but can introduce deadlocks if used poorly.
- Locking does not automatically make a whole design correct.