Chapter 15 - Distributed Systems | Concepts and Design, Fifth Edition

Download Report

Transcript Chapter 15 - Distributed Systems | Concepts and Design, Fifth Edition

Slides for Chapter 15:
Coordination and Agreement
From Coulouris, Dollimore, Kindberg and
Blair
Distributed Systems:
Concepts and Design
Edition 5, © Addison-Wesley 2012
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
Figure 15.2
Server managing a mutual exclusion token for a set of processes
Queue of
requests
Server
4
2
1. Request
token
p
1
p2
3. Grant
token
2. Release
token
p
3
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
p4
Figure 15.3
A ring of processes transferring a mutual exclusion token
p
1
p
2
p
n
p
3
p
4
T oken
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;
On receipt of a request <Ti, pi> at pj (i ≠ j)
if (state = HELD or (state = WANTED and (T, pj) < (Ti, pi)))
then
queue request from pi without replying;
else
reply immediately to pi;
end if
To exit the critical section
state := RELEASED;
reply to any queued requests;
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
p
41
p
3
Reply
1
34
Reply
34
Reply
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
On initialization
state := RELEASED;
voted := FALSE;
For pi to enter the critical section
state := WANTED;
Multicast request to all processes in Vi;
Wait until (number of replies received = K);
state := HELD;
On receipt of a request from pi at pj
if (state = HELD or voted = TRUE)
then
queue request from pi without replying;
else
send reply to pi;
voted := TRUE;
end if
For pi to exit the critical section
state := RELEASED;
Multicast release to all processes in Vi;
On receipt of a release from pi at pj
if (queue of requests is non-empty)
then
remove head of queue – from pk, say;
send reply to pk;
voted := TRUE;
else
voted := FALSE;
end if
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.7
A ring-based election in progress
3
17
4
24
9
1
15
28
24
Note: The election was started by process 17.
The highest process identifier encountered so far is 24.
Participant processes are shown in a darker colour
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.8
The bully algorithm
The election of coordinator p2,
after the failure of p4 and then p3
elect ion
C
elect ion
Stage 1
p
answer
1
p
p
2
p
3
4
answer
elect ion
elect ion
elect ion
C
Stage 2
p1
p
2
answer
p
3
p
4
timeout
Stage 3
p
p
1
Eventually. ... .
2
p
3
p
4
coordinator
C
Stage 4
p
1
p
2
p
3
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
p
4
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
Mes sage
proc es si ng
deli ver
Hold-bac k
queue
Incoming
mes sages
Deli very queue
When delivery
guarantees are
met
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
Figure 15.11
Total, FIFO and causal ordering of multicast messages
Notice the consistent
ordering of totally ordered
messages T1 and T2,
the FIFO-related messages
F1 and F2 and the causally
related messages C1 and C3
– and the otherwise arbitrary
delivery ordering of
messages.
T1
T2
F1
F3
F2
T ime
C1
C2
P1
C3
P2
Instructor’s Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
© Pearson Education 2012
P3
Figure 15.12
Display from bulletin board program
Bulletin board: os.interesting
Item
From
Subject
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
P1
d1 :=proc eed
d2 :=proc eed
P2
v2=proceed
v1 =proceed
1
Consens us algori thm
v3=abort
P3 (crashes)
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)
1:v
1:v
2:1:v
p2
1:x
1:w
2:1:w
p3
p2
3:1:u
p3
3:1:x
Faulty processes are shown coloured
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)
1:v
1:v
1:u
1:w
1:v
1:v
2:1:v
p2
2:1:u
p3
3:1:u
4:1:v
p2
4:1:v
2:1:v
4:1:v
3:1:w
p3
3:1:w
4:1:v
2:1:u
p4
3:1:w
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