Mutex

Turkish equivalent: Karşılıklı dışlama kilidiDomain: Concurrency

A mutual-exclusion synchronization primitive that allows only one execution context at a time to enter a protected critical section.

A mutex prevents multiple threads from entering the same protected critical section concurrently. Its cost is not limited to the lock and unlock instructions: contention, scheduler transitions, cache-line movement, and priority inversion can dominate latency under load.

The protected scope should be as small as practical without splitting the invariant being protected. When several mutexes are involved, inconsistent acquisition order can produce deadlock. Read-mostly or highly parallel workloads may benefit from different synchronization techniques, but the choice should follow access patterns and measurement rather than fashion.

Related: Critical Section, Deadlock, Priority Inversion, Lock-Free.