Skip to content
StackDecode
System Design
6. Distributed Systems FundamentalsAnimated

Distributed Mutual Exclusion

Only one node enters a critical section.

The idea

Algorithms use messages or a lock service so that only one process holds the lock.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

Client AClient BLock serviceacquire "job-42" (lease 10s)
  • current message
  • earlier
  • failure or attack

A asks for the lock with a time-limited lease.

step:
1/7
from:
Client A
to:
Lock service
1/7

Time runs downward. Solid arrows are requests, dashed arrows are replies.

Step by step

  1. 1Request the lock
  2. 2Wait for grant
  3. 3Enter the critical section
  4. 4Release

Where it is used

Shared resources.

Watch out for

Lock holders can crash or pause. Use leases and fencing.

Related