Ch8 Coordination
Ch8 Coordination
Coordination
(Mutual exclusion & Election)
Thoai Nam
High Performance Computing Lab (HPC Lab)
Faculty of Computer Science and Engineering
HCMC University of Technology
ME1: (safety) At most one process may execute in the critical section (CS) at a time
ME2: (liveness) Requests to enter and exit the critical section eventually succeed
ME3: (Optional, stronger) Requests to enter granted according to causality order
(4) (3)
• Pros
o Mutual exclusion is guaranteed without deadlock or starvation
• Cons
o N points of failure (crashed process interpreted as denial of access)
o Requires more communication
o Low efficiency, as all processes are involved in all decisions (n bottlenecks).
• A voting set Vi with each process pi ( i = 1, 2,..., N ), where Vi ⊆ {p1, p2, ..., pN}
• The sets Vi are chosen so that, for all i, j = 1, 2,..., N:
o pi ∈ V i
o Vi ⋂ Vj ≠ ∅, there is at least one common member of any two voting sets
o |Vi| = K - to be fair, each process has a voting set of the same size
o Each process pi is contained in M of the voting sets Vi.
• Optimal solution
o K ~ !!, M = K
• Pros
o No starvation
o Relatively easy to recover
• Cons
o Token can disappear (be loss)
o Long delay between successive appearances of the token.
Success
Order dispatched
Charge
Success
Multiple copies
1. (a) Process 4 first notices that coordinator has crashed and sends ELECTION to processes with
higher numbers 5,6, and 7
2. (b)-(d) Election proceeds, converging into process 6 winning
3. (e) By sending COORDINATOR message process 6 announces it is ready to take over
4. If process 7 is restarted, it will send COORDINATOR message to others and bully them into
submission.
HPC Lab - CSE - HCMUT 28
election
C
election
Eventually.....
coordinator
C
Stage 4
p p p p
1 2 3 4
(5) (4)