Distributed lock.
A single key, held across machines, that lets only one of them touch a shared thing at a time.
- 1
Many machines, no shared memory — yet only one should touch the shared thing.
- 2
So you keep a single key in a store every machine can reach.
- Got it — mine.3
Whoever grabs the key gets exclusive permission; the rest wait or back off.
- 4
The key is a lease, not forever: it auto-expires unless the holder keeps renewing.
- …wait, still mine?5
The danger: a holder stalls past expiry, so the lease is handed on while it still thinks it holds it.
- 6
A fencing token fixes it: each grant gets a higher number, and the resource refuses any stale one.
Semicolony semicolony.dev/eli5/distributed-lock/comic