Physics · Primitives

Lock

Mutual exclusion enforcement

Definition

Mechanism

A synchronization primitive that enforces exclusive access to a resource. At most one holder may access the protected resource at any time. The holder must explicitly release the lock to allow others to acquire it.

Preconditions

  1. Shared resource exists
  2. Contending parties can communicate

Postconditions

  1. Exactly one party holds exclusive access
  2. Other contenders are blocked or queued

Invariants

  1. Exclusivity: At most one holder at any time.
  2. Acquire-before-access: Protected resource cannot be touched without holding the lock.
  3. Release-after-use: Holder must release after completing the critical section.

Risks

Failure modes

  1. Deadlock

    Holder crashes or hangs without releasing, blocking all other contenders indefinitely.

  2. Priority Inversion

    High-priority contender blocked by low-priority holder.

Caution

Exclusive access — starvation enables denial of service.

Relationships

Root pattern: builds on nothing in this library.

Used by

References

Infrastructure

Mutex

Ownership-based mutual exclusion

Society

StateLock

Atomic coordination via temporary state fusion

Society

WorkerMode

Claim tasks and become the assigned persona

Extends

Infrastructure

Mutex

Ownership-based mutual exclusion

Reference

Identity

Ref
Lock#95c2
Sema ID
sema:Lock#mh:SHA-256:95c2ee952a5301d4b346a5e8693350829d88b3c600048eedcf87bb00c23ee5fb
Ring
0
Tier
1
Updated
2026-11-11