Mutual Exclusion RECORD
Mutual Exclusion RECORD
Mutual Exclusion
• A condition in which there is a set of processes, only one of which is
able to access a given resource or perform a given function at any
time
Centralized Systems
Mutual exclusion via:
– Test & set
– Semaphores
– Messages
– Monitors
Centralized algorithm
• Mimic single processor system
• One process elected as coordinator
1. Request resource
2. Wait for response
3. Receive grant
4. Access resource
5. Release resource
Centralized algorithm:
If another process claimed resource:
– Maintain queue
Benefits
• Fair
Problems
• Process cannot distinguish being blocked from a dead coordinator
• Centralized server can be a bottleneck
– Initialization
– From Pi to P(i+1)mod N
– Order well-defined
• Name of resource
• Send OK to sender
• Earliest wins
• N points of failure
• This may cause its own entry have the earliest timestamp in
the queue, enabling it to access the critical section
Decentralized Algorithm
• Based on the Distributed Hash Table (DHT) system structure previously
introduced
– Peer-to-peer
– Object names are hashed to find the successor node that will store
them
• For a process to use the resource it must receive permission from m > n/2
coordinators
• The coordinator notifies the requester when it has been denied access as
well as when it is granted
• If a process (requester) gets fewer than m votes it will wait for a random
time and then ask again
• If a resource is in high demand, multiple requests will be generated
• It’s possible that processes will wait a long time to get permission
• Deadlock?
• More robust than the central coordinator approach and the distributed
approaches. If one coordinator goes down others are available.