Lecture #6: Distributed Mutual Exclusion

These topics are from Chapter 6 (Distributed Mutual Exclusion) in Advanced Concepts in OS, supplemented with other materials.

Topics for Today

Lamport's Mutual Exclusion Algorithm

* Are these the single-integer valued clocks, or the vector clocks?

The Algorithm


Suppose Si and Sj are executing the CS concurrently.

L1 and L2 must hold at both sites concurrently.

Si and Sj both have requests at top of their queues and L1 holds, at some instant t.

WLOG suppose Si's request has earlier timestamp than Sj's.
(Remember the tie-breaking rule!)

Assuming communication channels are FIFO, at instant t Si's request is queued at Sj, when Sj is in the CS and Sj's own request is at the top of the queue, ahead of a smaller timestamp request.

This is a contradiction.


(Possibly step through additinal examples on the blackboard.)


What does this assume about transmission delay versus message processing delay?

Token-Based Algorithms

Suzuki-Kasami Broadcast Algorithm

Each site Si keeps an array of integers RNi[1..N], where RNi[j] is the largest sequence number received so far from Sj.

Performance of Suzuki-Kazami Algorithm

Comparison of Lamport and Suzuki-Kazami Algorithms

The essential difference is in who keeps the queue. In one case every site keeps its own local copy of the queue. In the other case, the queue is passed around within the token.

What is gained by this scheme versus the centralized mutual exclusion scheme?

Raymond's Tree-Based Algorithm

Si requests entry to CS

Sj receives request from Si

Si receives token

Si leaves a CS

Properties of Raymond's Algorithm

On what assumption(s) does average-case analysis depend?

What are worst-case metrics?

What is degenerate case?

What trade-off does this point out?

Worst Case in Balanced Binary Tree

What is the worst-case number of messages if the topology is a balanced binary tree?

How about other topologies?

Universal Bounds

min synch delay T message to permit
max throughput 1/(T+E) message to transmit + CS
min response time 2T + E round trip + CS
max avg resp time N(T + E) all others served first*