6. Chapter 6: Coordination and Agreement
6.2. Distributed Mutual Exclusion
Distributed
Mutual Exclusion
- Mutual exclusion is required to prevent interference and ensure consistency when accessing the shared resources.
- Distributed mutual exclusion – based solely on message passing.
- In some cases, shared resources are managed by servers that also provide mechanisms for mutual exclusion.
- UNIX systems provide file-locking service, implemented by the daemon lockd, to handle locking requests from clients.
- When there is no server, and a collection of peer processes must coordinate their accesses to shared resources amongst themselves.
- It is useful to have a generic mechanism for distributed mutual exclusion – one that is independent of the particular management scheme.
- Mutual exclusion algorithms
Algorithms
for mutual exclusion
- A system of N processes pi, i = 1, 2, …, N, that do not share variables.
- The processes access common resources, but they do so in a critical section.
- Assume there is only one critical section.
- Assume that the system is asynchronous, that processes do not fail and that message delivery is reliable.
- Application-level protocol for executing a critical section:
- enter() // enter critical section – block if necessary
- resourceAccesses() // access shared resources in critical section
- exit() // leave critical section – other processes may now enter
- Essential requirements for mutual exclusion:
- ME1: (safety) – at most one process may execute in the critical section (CS) at a time.
- ME2: (liveness) – request to enter and exit the critical section eventually succeed.
- ME3: (-> ordering) – if one request enter the CS happened-before another, then entry to the CS is granted in that order.
- Evaluation of the performance for mutual exclusion algorithms is according to the following criteria:
- The bandwidth consumed, which is proportional to the number of messages sent in each entry and exit operation;
- The client delay incurred by a process at each entry and exit operation;
- The algorithm’s effect upon the throughput of the system.
- Using synchronization delay between one process exiting the critical section and the next process entering it
- The throughput is greater when the synchronization delay is shorter.
- Also assumes that the client processes are well behaved and spend a finite time accessing resources within their critical sections.
- The central server algorithm

- Performance of this algorithm
- Entering the critical section – even when no process currently occupies it – takes two messages (a request followed by a grant) and the delays the requesting process by the time required for this round-trip.
- Exiting the critical section takes one release message.
- Assuming asynchronous message passing, the release message does not delay the exiting process.
- Server may become a performance bottleneck for the system as a whole.
- Synchronization delay -> time taken for a round-trip: a release message to the server, followed by a grant message to the next process to enter the critical section.
- A ring-based algorithm
- An algorithm using multicast and logical clocks