{
  "handle": "Mutex",
  "mechanism": "An ownership-bearing {{lock}} for a shared {{resource}}. An {{actor}} 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.",
  "gloss": "Ownership-based mutual exclusion",
  "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."
  ],
  "invariants": [
    "Exclusivity: at most one {{actor}} owns the mutex at a time.",
    "Acquire-before-access: an {{actor}} 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}} 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."
  ],
  "_meta": {
    "tier": 1,
    "ring": 0,
    "caution": "Exclusive access — starvation enables denial of service.",
    "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"
    ],
    "path": [
      "Infrastructure",
      "Primitives"
    ]
  },
  "sema_id": "sema:Mutex#mh:SHA-256:b031c2dc75f23526ac765e042cd1ff77f66f0a7a23d57e480b30da0a8343e18e",
  "sema_ref": "Mutex#b031",
  "sema_stub": "b031",
  "extends": "sema:Lock#mh:SHA-256:95c2ee952a5301d4b346a5e8693350829d88b3c600048eedcf87bb00c23ee5fb",
  "dependencies": {
    "accepts": {
      "actor": "sema:Actor#mh:SHA-256:86fc0930b97ffb4fe85d4820af8e17a43166b745d181895f576edf39edde6aa8"
    },
    "references": {
      "lock": "sema:Lock#mh:SHA-256:95c2ee952a5301d4b346a5e8693350829d88b3c600048eedcf87bb00c23ee5fb",
      "resource": "sema:Resource#mh:SHA-256:0e5e5e6735fa9ee49f7e623029d977e435625b8ad05b28f83f962683a0ebb19b"
    }
  },
  "sema_layer": "Infrastructure",
  "sema_category": "Primitives",
  "used_by": {}
}
