06 Synchronization
06 Synchronization
SYNCHRONIZATION
¨ The machines
answer.
The Berkeley Algorithm (3)
¨ The critical
path in the case
of RBS.
2. Logical clock
2 conditions:
3. Mutual exclusion
¨ A Centralized Algorithm
¨ A Decentralized Algorithm
¨ A Distributed Algorithm
¨ A Token Ring Algorithm
¨ A Comparison of the Three Algorithms
Mutual Exclusion
3.1. A Centralized Algorithm (1)
P1
¤ If yes, access resource
P
5
P3
3.4. Decentralized Algorithm
¨ Based on the requester
Distributed Hash Table
(DHT) system structure rname
previously introduced
¤ Peer-to-peer
¤ Object names are c0 c1 cn-1
hashed to find the
successor node that will
store them …
rname0 rname1 rnamen-1
¨ Here, we assume that n
replicas of each object
are stored
Placing the Replicas
¨ The resource is known by a unique name: rname
¤ Replicas: rname-0, rname-I, …, rname-(n-1)
¤ rname-i is stored at succ(rname-i), where names
and site names are hashed as before
¤ If a process knows the name of the resource it
wishes to access, it also can generate the hash
keys that are used to locate all the replicas
The Decentralized Algorithm
¨ Every replica has a coordinator that controls access
to it (the coordinator is the node that stores it)
¨ For a process to use the resource it must receive
permission from m > n/2 coordinators
¨ This guarantees exclusive access as long as a
coordinator only grants access to one process at a
time
The Decentralized Algorithm
¨ The coordinator notifies the requester when it has
been denied access as well as when it is granted
¤ Requester must “count the votes”, and decide
whether or not overall permission has been
granted or denied
¨ If a process (requester) gets fewer than m votes it
will wait for a random time and then ask again
4. Election Algorithms
¨ Traditional Election algorithms
¤ The Bully Algorithm
¤ A Ring Algorithm