Half An Algorithm
Lamport's 1978 distributed mutual exclusion algorithm, condensed. Every message is timestamped, every process keeps a private request queue, and channels between any pair of processes are FIFO.
1. request: send (T_i, "P_i requests") to all others; enqueue it locally.
2. on request from P_j: enqueue it; send P_j a timestamped ack.
3. release: remove own request from the queue; tell all others.
4. on release from P_j: remove P_j's request from the queue.
5. grant to P_i when BOTH hold:
(i) P_i's own request is ordered first in P_i's queue by (T, pid)
(ii) P_i has received a message from EVERY other process
timestamped later than T_i
A team implements rules 1 through 4 and condition (i), and drops condition (ii) as redundant bookkeeping. With three processes and clocks near zero: P3 requests at T=4, P1 requests at T=7, and P3's request message to P1 is stuck in the network for 500 ms. What breaks?
Sign in to answer questions and track your progress
Sign In