Chapter 15
Chapter 15
• Introduction
• Distributed mutual exclusion
• Elections
• Coordination and agreement in group communication (skip)
• Consensus and related problems (skip)
2
Introduction
3
Figure 15.1
A network partition
Cras hed
router
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Overview of Chapter
• Introduction
• Distributed mutual exclusion
• Elections
• Coordination and agreement in group communication
• Consensus and related problems
5
Distributed mutual exclusion
Conditions:
• ME1 (safety) – at most one process in critical section
• ME2 (liveness) – requests eventually succeed
• ME3 (ordering) – requests follow happened-before relationship
6
Distributed mutual exclusion
Various algorithms:
• Central server algorithm
• Ring-based algorithm
• Algorithm using multicast and logical clocks
• Voting algorithm
• Others
7
Figure 15.2
Server managing a mutual exclusion token for a set of processes
Server
Queue of
requests
4
2
3. Grant
token
1. Request
token
2. Release p4
p token
1
p2 p
3
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.3
A ring of processes transferring a mutual exclusion token
p
1 p
2
pn
p
3
p
4
Token
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.4
Ricart and Agrawala’s algorithm
On initialization
state := RELEASED;
To enter the section
state := WANTED;
Multicast request to all processes; request processing deferred here
T := request’s timestamp;
Wait until (number of replies received = (N – 1));
state := HELD;
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.5
Multicast synchronization
41
41 p
3
p Reply
1
Reply 34
Reply
34
41
p 34
2
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.6
Maekawa’s algorithm – part 1
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Overview of Chapter
• Introduction
• Distributed mutual exclusion
• Elections
• Coordination and agreement in group communication
• Consensus and related problems
13
Elections
Election algorithms:
• Used to choose a particular process for a role – for example, to
choose a central server for distributed algorithms that require a
central server
• Process can call an election; for example, if it detects that central
server has failed
Requirements:
• E1: (safety) only one process is elected – each participant sets
electedi either to P or to undefined if it does not know the elected
process yet (P will be the participant with the largest process id)
• E2: (liveness) all processes participate and either set electedi to the
elected process or crash
14
Elections
Election algorithms:
• Ring-based algorithm
• Bully algorithm
15
Figure 15.7
A ring-based election in progress
3
17
24
15
28 24
election election C
Stage 2
answer
p1 p p p
2 3 4
timeout
Stage 3
p p p p
1 2 3 4
Eventually.....
coordinator
C
Stage 4
p p p p
1 2 3 4
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Overview of Chapter
• Introduction
• Distributed mutual exclusion
• Elections
• Coordination and agreement in group communication (skip)
• Consensus and related problems
18
Figure 15.9
Reliable multicast algorithm
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.10
The hold-back queue for arriving multicast messages
Message
proc es sing
deliv er
Hold-bac k
queue Deliv ery queue
T1
Notice the consistent T2
delivery ordering of
messages.
Time
C1
C2
C3
P1 P2 P3
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.12
Display from bulletin board program
23 A.Hanlon Mach
24 G.Joseph Microkernels
25 A.Hanlon Re: Microkernels
26 T.L’Heureux RPC performance
27 M.Walker Re: Mach
end
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.13
Total ordering using a sequencer
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.14
The ISIS algorithm for total ordering
P2
1 Message
3
22 P4
1
3 Agreed Seq
1
2 P1
3
P3
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.15
Causal ordering using vector timestamps
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.16
Consensus for three processes
d1 :=proceed d2 :=proceed
P1 P2
v1 =proceed v2=proceed
1
Consens us algorithm
v3=abort
P3 (c rashes )
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.17
Consensus in a synchronous system
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.18
Three Byzantine generals
p1 (Commander) p1 (Commander)
2:1:v 2:1:w
p2 p3 p2 p3
3:1:u 3:1:x
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.19
Four Byzantine generals
p1 (Commander) p1 (Commander)
p4 p4
Faulty processes are shown coloured
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012