Show in graph
OS

Software → Operating Systems

Mutex

A synchronization primitive that ensures only one thread accesses a critical section at a time.

Motivation

Mutex solves the problem of allowing only one execution flow into a critical section at a time.

Where it fits

Mutex belongs to synchronization and concurrent programming.

Mental model

A mutex is a lock: acquire before touching shared state, release when done.

Common mistakes

  • Forgetting to release locks on errors.
  • Holding locks while doing slow I/O.

Mutex connects to critical section, race condition, deadlock, and synchronization.