Você está na página 1de 20

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

Crashed
router

Instructors 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

Server
Queue of
requests
4

2
3. Grant
token

1. Request
token
2. Release p4
p token
1

p2 p
3

Instructors 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

Instructors Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
Pearson Education 2012
Figure 15.4
Ricart and Agrawalas algorithm

On initialization
state := RELEASED;
To enter the section
state := WANTED;
Multicast request to all processes; request processing deferred here
T := requests 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;

Instructors 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

Instructors Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
Pearson Education 2012
Figure 15.6
Maekawas algorithm part 1

On initialization For pi to exit the critical section


state := RELEASED; state := RELEASED;
voted := FALSE; Multicast release to all processes in Vi;
For pi to enter the critical section On receipt of a release from pi at pj
state := WANTED; if (queue of requests is non-empty)
Multicast request to all processes in Vi; then
Wait until (number of replies received = K); remove head of queue from pk, say;
state := HELD; send reply to pk;
voted := TRUE;
On receipt of a request from pi at pj else
if (state = HELD or voted = TRUE) voted := FALSE;
then end if
queue request from pi without replying;
else
send reply to pi;
voted := TRUE;
end if

Instructors 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

24

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
Instructors 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, election


after the failure of p4 and then p3 election
C
Stage 1
answer
p p p p
1 2 3 4
answer
election

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 ... ..
coordinat or
C
Stage 4
p p p p
1 2 3 4

Instructors Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
Pearson Education 2012
Figure 15.9
Reliable multicast algorithm

Instructors 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

Mess age
proc es sing

deliv er
Hold-back
queue Delivery queue

When deliv ery


guarantees are
met
Inc oming
mess ages
Instructors 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

T1
Notice the consistent T2

ordering of totally ordered


messages T1 and T2,
the FIFO-related messages
F1 and F2 and the causally F1
related messages C1 and C3
and the otherwise arbitrary F2
F3

delivery ordering of
messages.
Time

C1

C2
C3

P1 P2 P3
Instructors 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

Bulletin board: os.interesting


Item From Subject

23 A.Hanlon Mach
24 G.Joseph Microkernels
25 A.Hanlon Re: Microkernels
26 T.LHeureux RPC performance
27 M.Walker Re: Mach
end

Instructors 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

Instructors 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

Instructors 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

Instructors 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

Cons ensus algorithm

v3=abort

P3 (c ras hes)

Instructors 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

Instructors 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 1:w 1:x

2:1:v 2:1:w
p2 p3 p2 p3
3:1:u 3:1:x

Faulty processes are shown coloured

Instructors 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 2:1:u
p2 3:1:u p3 p2 3:1:w p3
4:1:v 4:1:v 4:1:v 4:1:v
2:1:v 3:1:w 2:1:u 3:1:w

p4 p4
Faulty processes are shown coloured

Instructors Guide for Coulouris, Dollimore, Kindberg and Blair, Distributed Systems: Concepts and Design Edn. 5
Pearson Education 2012

Você também pode gostar