Distributed Systems: Mutual Exclusion
Distributed Systems: Mutual Exclusion
Distributed Systems: Mutual Exclusion
Mutual Exclusion*
Page 1
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
Page 2
Centralized Systems
Mutual exclusion via:
Page 3
Page 4
Centralized Algorithm
Token Ring Algorithm
Distributed Algorithm
Decentralized Algorithm
Page 5
Centralized algorithm
Mimic single processor system
One process elected as coordinator
1.
2.
3.
4.
5.
Request resource
Wait for response
Receive grant
access resource
Release resource
request(R)
grant(R)
P
release(R)
Page 6
Centralized algorithm
If another process claimed resource:
Coordinator does not reply until release
Maintain queue
Service requests in FIFO order
Queue
P1
P2
request(R)
P0
request(R)
grant(R)
grant(R)
release(R)
P2
request(R)
P1
Page 7
Centralized algorithm
Benefits
Fair
All requests processed in order
Page 8
P5
P4
P2
P3
Page 9
P4
P2
P3
token(R)
Page 10
Order well-defined
Starvation cannot occur
Page 11
Page 12
Page 14
Page 15
(accessing resource):
Page 16
Page 17
Characteristics of Decentralized
Algorithms
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
Page 19
Page 20
Page 21
Page 22
Analysis
If a resource is in high demand, multiple
requests will be generated
Its possible that processes will wait a long
time to get permission
Deadlock?
Resource usage drops
Page 23
Analysis
More robust than the central coordinator
approach and the distributed approaches. If
one coordinator goes down others are
available.
Page 24