---
slug: "Mutex"
name: "Mutex"
type: "Primitives"
layer: "Infrastructure"
ref: "Mutex#b031"
sema_id: "sema:Mutex#mh:SHA-256:b031c2dc75f23526ac765e042cd1ff77f66f0a7a23d57e480b30da0a8343e18e"
tags: ["Infrastructure","Primitives"]
updated: 2026-11-11
mindscape: "bootstrap"
index_url: https://mindscape.pages.dev/bootstrap/index.json
url: https://mindscape.pages.dev/bootstrap/Mutex/
related: ["Actor","Lock","Resource"]
---

# Mutex

Ownership-based mutual exclusion

Layer: Infrastructure · Category: Primitives

## Mechanism

An ownership-bearing [Lock](https://mindscape.pages.dev/bootstrap/Lock.md) for a shared [Resource](https://mindscape.pages.dev/bootstrap/Resource.md). An [Actor](https://mindscape.pages.dev/bootstrap/Actor.md) that successfully acquires it becomes the sole owner and may enter the protected section. Only the owner may release it; another contender becomes owner only through a later successful acquisition after release.

## Invariants

- Exclusivity: at most one [Actor](https://mindscape.pages.dev/bootstrap/Actor.md) owns the mutex at a time.
- Acquire-before-access: an [Actor](https://mindscape.pages.dev/bootstrap/Actor.md) enters the protected section only after successful acquisition.
- Owner-only release: only the current owner may perform an ordinary release.
- Release-after-use: the owner releases the mutex after leaving the protected section.

## Preconditions

- A shared [Resource](https://mindscape.pages.dev/bootstrap/Resource.md) and protected section exist.
- All contenders use the same mutex state.

## Postconditions

- A successful acquisition yields exactly one owner.
- Non-owners do not enter the protected section.
- Release removes the former owner's protected access.

## Failure modes

- Deadlock: contenders form a wait cycle and no acquisition can complete.
- Orphaned ownership: an owner fails without release, leaving the mutex unavailable.
- Starvation: a contender is repeatedly denied under the selected acquisition policy.
- Ownership violation: a non-owner releases the mutex or enters the protected section.

## Caution

Exclusive access — starvation enables denial of service.

## Builds on

- [Actor](https://mindscape.pages.dev/bootstrap/Actor.md) (Infrastructure; Accepts)
- [Lock](https://mindscape.pages.dev/bootstrap/Lock.md) (Physics; References)
- [Resource](https://mindscape.pages.dev/bootstrap/Resource.md) (Infrastructure; References)
- [Lock](https://mindscape.pages.dev/bootstrap/Lock.md) (Physics; Extends)

## Used by

—

## Identity

- Sema ID: `sema:Mutex#mh:SHA-256:b031c2dc75f23526ac765e042cd1ff77f66f0a7a23d57e480b30da0a8343e18e`
- Ref: `Mutex#b031`
- Supersedes:
  - `sema:Mutex#mh:SHA-256:0586e1f0cdc4324c2c846715464a128e9d07dd27312d56828739153ec826a8c7`
  - `sema:Mutex#mh:SHA-256:58bad5fd876ab54e26c1bb6882ca10aadc55681be7b443a0fb89239b184a6866`
  - `sema:Mutex#mh:SHA-256:8dd85c0416d43c4ab968b319b446b7c5d4ff388f01e672d2557658009540772c`
  - `sema:Mutex#mh:SHA-256:d9da0ec55a6d14140ae31a4e65652489310350cc52caca6a61258e42abc6b204`

## Links

- [Pattern page](https://mindscape.pages.dev/bootstrap/Mutex/)
- [View in the interactive graph](https://mindscape.pages.dev/bootstrap/#Mutex)
- [JSON](https://mindscape.pages.dev/bootstrap/Mutex.json)
- [Index of all patterns](https://mindscape.pages.dev/bootstrap/index.json)
