Mutex

A mutex is a synchronization primitive that allows only one thread or process to enter a critical section at a time.
Also known as
mutual exclusion lock

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.

Need this inside a product?

The studio builds the systems these terms describe. Tell us what you are working on.