cs.brown.edu

Download Report

Transcript cs.brown.edu

Two-Process Systems
Companion slides for
Distributed Computing
Through Combinatorial Topology
Maurice Herlihy & Dmitry Kozlov & Sergio Rajsbaum
Distributed Computing through
Combinatorial Topology
Two-Process Systems
Two-process systems can
be captured by elementary
graph theory
gentle introduction to more
general structures needed
later for larger systems
Distributed Computing through
2
Combinatorial Topology
Road Map
Elementary Graph Theory
Tasks
Models of Computation
Approximate Agreement
Task Solvability
Distributed Computing through
Combinatorial Topology
3
Road Map
Elementary Graph Theory
Tasks
Models of Computation
Approximate Agreement
Task Solvability
Distributed Computing through
Combinatorial Topology
4
A Vertex
Distributed Computing through
Combinatorial Topology
5
A Vertex
Combinatorial: an element of a set.
Distributed Computing through
Combinatorial Topology
6
A Vertex
Combinatorial: an element of a set.
Geometric: a point in Euclidean Space
Distributed Computing through
Combinatorial Topology
7
An Edge
8
An Edge
Combinatorial: a set of two vertexes.
9
An Edge
Combinatorial: a set of two vertexes.
Geometric: line segment joining two points
10
A Graph
Distributed Computing through
Combinatorial Topology
11
A Graph
Combinatorial: a set of sets of vertices.
Distributed Computing through
Combinatorial Topology
12
A Graph
Combinatorial: a set of sets of vertices.
Geometric: points joined by line segments
Distributed Computing through
Combinatorial Topology
13
Graphs
finite set V with a collection
G of subsets of V,
Distributed Computing through
Combinatorial Topology
14
Graphs
vertices
finite set V with a collection
G of subsets of V,
simplices
(singular: simplex)
Distributed Computing through
Combinatorial Topology
15
Graphs
finite set V with a collection
G of subsets of V,
(1) If X 2 G, then |X| · 2
Distributed Computing through
Combinatorial Topology
16
Graphs
finite set V with a collection
G of subsets of V,
(1) If X 2 G, then |X| · 2
vertex: |X| = 1
edge: |X|= 2
Distributed Computing through
Combinatorial Topology
17
Graphs
finite set V with a collection
G of subsets of V,
(1) If X 2 G, then |X| · 2
(2) for all v 2 V, {v} 2 G
18
Graphs
finite set V with a collection
G of subsets of V,
(1) If X 2 G, then |X| · 2
(2) for all v 2 V, {v} 2 G
(3) for all X 2 G, and Y ½ X, Y 2 G
19
Dimension
dimension 0
dimension 1
dim(X) = |X|-1.
Distributed Computing through
Combinatorial Topology
20
Pure Graphs
pure of dim 0
pure of dim 1
Distributed Computing through
Combinatorial Topology
21
Graph Coloring
Distributed Computing through
Combinatorial Topology
22
Graph Coloring
Â: G ! C
Distributed Computing through
Combinatorial Topology
23
Graph Coloring
Â: G ! C
for each edge (s0, s1) 2 G, Â(s0)  Â(s1).
Distributed Computing through
Combinatorial Topology
24
Graph Coloring
Â: G ! C
for each edge (s0, s1) 2 G, Â(s0)  Â(s1).
chromatic graphs
usually process names
Distributed Computing through
Combinatorial Topology
25
Graph Labeling
0
1
0
1
Distributed Computing through
Combinatorial Topology
26
Graph Labeling
0
1
f: G ! L
0
1
Distributed Computing through
Combinatorial Topology
27
Graph Labeling
0
1
0
1
f: G ! L
usually values from some domain
Distributed Computing through
Combinatorial Topology
28
Labeled Chromatic Graph
1
0
1
0
name(s) = Â(s)
view(s) = f(s)
Distributed Computing through
Combinatorial Topology
29
Simplicial Maps
Vertex-to-vertex map …
that also sends edges to edges.
Distributed Computing through
Combinatorial Topology
30
Rigid Simplicial Maps
A simplicial map can send
an edge to a vertex …
Distributed Computing through
Combinatorial Topology
31
Rigid Simplicial Maps
A simplicial map can send
an edge to a vertex …
A simplicial map that sends
distinct vertices to distinct
vertices is rigid.
Distributed Computing through
Combinatorial Topology
32
A Path Between two Vertices
Distributed Computing through
Combinatorial Topology
33
A Path Between two Vertices
A graph is connected if
there is a path between
every pair of vertices
Distributed Computing through
Combinatorial Topology
34
Not Connected
A graph is connected if
there is a path between
every pair of vertices
Distributed Computing through
Combinatorial Topology
35
Theorem
Theorem
The image of a connected
graph under a simplicial map
is connected.
Á
Distributed Computing through
Combinatorial Topology
36
Carrier Maps
For graphs G, H, a carrier map
©: G ! 2H
©
Carries each simplex of G to a subgraph of H …
Distributed Computing through
Combinatorial Topology
37
Carrier Maps
For graphs G, H, a carrier map
©: G ! 2H
©
Carries each simplex of G to a subgraph of H …
satisfying monotonicity:
for allDistributed
¾,¿2G,
if ¾µ¿, then ©(¾)µ©(¿).38
Computing through
Combinatorial Topology
Strict Carrier Maps
Monotonicity
For all ¾,¿2G, if ¾µ¿, then ©(¾)µ©(¿).
Distributed Computing through
Combinatorial Topology
39
Strict Carrier Maps
Monotonicity
For all ¾,¿2G, if ¾µ¿, then ©(¾)µ©(¿).
Equivalent to …
©(¾Å¿) µ ©(¾) Å ©(¿)
Distributed Computing through
Combinatorial Topology
40
Strict Carrier Maps
Monotonicity
For all ¾,¿2G, if ¾µ¿, then ©(¾)µ©(¿).
Equivalent to …
©(¾Å¿) µ ©(¾) Å ©(¿)
Definition
© is strict if ©(¾Å¿) = ©(¾) Å ©(¿)
Distributed Computing through
Combinatorial Topology
41
Road Map
Elementary Graph Theory
Tasks
Models of Computation
Approximate Agreement
Task Solvability
Distributed Computing through
Combinatorial Topology
42
Two Processes
Hello! I’m
Hello! I’m
Alice
Bob
Distributed Computing through
Combinatorial Topology
43
Informal Task Definition
Processes start with input values …
They communicate …
They halt with output values …
legal for those inputs.
Distributed Computing through
Combinatorial Topology
44
Formal Task Definition
Input graph I
all possible assignments of input values
Distributed Computing through
Combinatorial Topology
45
Formal Task Definition
Input graph I
all possible assignments of input values
Output graph O
all possible assignments of output values
Distributed Computing through
Combinatorial Topology
46
Formal Task Definition
Input graph I
all possible assignments of input values
Output graph O
all possible assignments of output values
Carrier map ¢: I ! 2O
all possible assignments of output values
for each input
Distributed Computing through
Combinatorial Topology
47
Task Input Graph: Consensus
0
1
I
0
Distributed Computing through
Combinatorial Topology
1
48
Task Input Graph
0
1
I
0
1
Distributed Computing through
Combinatorial Topology
49
Task Input Graph
1
1
Pure
Colored by process names
Labeled by input values
0
0
Distributed Computing through
Combinatorial Topology
50
Task Output Graph
1
1
O
0
0
Distributed Computing through
Combinatorial Topology
51
Task Carrier Map
1
1
¢: I ! 2O
I
0
1
0
O
0
Distributed Computing through
Combinatorial Topology
1
0
52
Task Carrier Map
1
1
¢: I ! 2O
I
0
1
0
1
O
0
0
If Bob runs alone with input 1 …
then he decides output 1.
Distributed Computing through
Combinatorial Topology
53
Task Carrier Map
1
1
¢: I ! 2O
I
0
1
0
1
O
0
0
If Bob and Alice both have input 1 …
then they both decide output 1.
Distributed Computing through
Combinatorial Topology
54
Task Carrier Map
1
1
¢: I ! 2O
I
0
1
0
1
O
0
0
If Bob has 1 and Alice 0 …
then they must agree, on either one.
Distributed Computing through
Combinatorial Topology
55
Example: Coordinated Attack
Alice
Bob
Enemy
Alice and Bob win
If they both attack
together
Distributed Computing through
Combinatorial Topology
56
Input Graph
Attack at dawn!
I
Attack at noon!
Indifferent
Distributed Computing through
Combinatorial Topology
57
Output Graph
failed!
dawn!
noon!
O
Distributed Computing through
Combinatorial Topology
58
Carrier Map
I
¢
O
Distributed Computing through
Combinatorial Topology
59
Carrier Map
dawn!
I
¢
dawn!
O
failed!
Distributed Computing through
Combinatorial Topology
60
Carrier Map
noon!
I
¢
O
failed!
Distributed Computing through
Combinatorial Topology
noon!
61
Carrier Map
dawn!
I
¢
dawn!
O
Distributed Computing through
Combinatorial Topology
62
Example: Coordinated Attack
Alice
Bob
Enemy
Distributed Computing through
Combinatorial Topology
63
Example: Coordinated Attack
Alice
Bob
Enemy
Alice and Bob realize that
they do not need to agree
on an exact time …
Distributed Computing through
Combinatorial Topology
64
Example: Coordinated Attack
Alice
Bob
Enemy
Alice and Bob realize that
they do not need to agree
on an exact time …
they will win if attack times
are sufficiently close.
Distributed Computing through
Combinatorial Topology
65
Coordinated Attack Graphs
I
0
1
¢
0
1/5
2/5
3/5
4/5
1
O
Distributed Computing through
Combinatorial Topology
66
Coordinated Attack Graphs
I
0
1
¢
0
1/5
2/5
3/5
4/5
1
O
Distributed Computing through
Combinatorial Topology
67
Coordinated Attack Graphs
I
0
1
¢
0
1/5
2/5
3/5
4/5
1
O
Distributed Computing through
Combinatorial Topology
68
Coordinated Attack Graphs
I
0
1
¢
0
1/5
2/5
3/5
4/5
1
O
Distributed Computing through
Combinatorial Topology
69
Road Map
Elementary Graph Theory
Tasks
Models of Computation
Approximate Agreement
Task Solvability
Distributed Computing through
Combinatorial Topology
70
Protocols
Models of Computation
Distributed Computing through
Combinatorial Topology
71
Alice’s Protocol
shared mem array 0..1 of Value
view: Value := my input value;
for i: int := 0 to L do
mem[A] := view;
view := view + mem[A] + mem[B];
return δ(view)
Finite program
Bob’s protocol is symmetric
Distributed Computing through
Combinatorial Topology
72
Alice’s Protocol
shared mem array 0..1 of Value
view:
:= mymemory
input value;
sharedValue
two-element
for i: int := 0 to L do
mem[A] := view;
view := view + mem[B];
return δ(view)
Distributed Computing through
Combinatorial Topology
73
Alice’s Protocol
shared mem array 0..1 of Value
view: Value := my input value;
for i: int :=
0 with
to input
L dovalue
Start
mem[A] := view;
view := view + mem[B];
return δ(view)
Distributed Computing through
Combinatorial Topology
74
Alice’s Protocol
shared mem array 0..1 of Value
view: Value := my input value;
for i: int := 0 to L do
mem[A] := view;
Run for L layers
view := view + mem[B];
return δ(view)
Distributed Computing through
Combinatorial Topology
75
Alice’s Protocol
shared mem array 0..1 of Value
view: Value := my input value;
for i: int := 0 to L do
mem[A] := view;
view := view + mem[B];
return Alice
δ(view)
writes her value, read Bob’s
value, and concatenate it to my view
Distributed Computing through
Combinatorial Topology
76
Alice’s Protocol
shared mem array 0..1 of Value
view: Value := my input value;
for i: int := 0 to L do
mem[A] := view;
view := view + mem[B];
return Alice
δ(view)
writes her value, read Bob’s
value, and concatenate it to my view
Distributed Computing through
Combinatorial Topology
77
Alice’s Protocol
shared mem array 0..1 of Value
view: Value := my input value;
for i: int := 0 to L do
mem[A] := view;
view := view + mem[B];
return δ(view)
finally, apply task-specific
decision map to view
Distributed Computing through
Combinatorial Topology
78
Formal Protocol Definition
Input graph I
all possible assignments of input values
Distributed Computing through
Combinatorial Topology
79
Formal Protocol Definition
Input graph I
all possible assignments of input values
Protocol graph P
all possible process views after execution
Distributed Computing through
Combinatorial Topology
80
Formal Protocol Definition
Input graph I
all possible assignments of input values
Protocol graph P
all possible process views after execution
Carrier map ¥: I ! 2P
all possible assignments of views
Distributed Computing through
Combinatorial Topology
81
One-Round Protocol Graph
I
0
1
¥
0?
01
01
?1
P
Distributed Computing through
Combinatorial Topology
82
One-Round Protocol Graph
P
0?
01
01
?1
Colored by process names
Labeled with final views
Distributed Computing through
Combinatorial Topology
83
One-Round Protocol Graph
P
0?
01
01
?1
Alice finishes before Bob
starts, doesn’t see his value
Distributed Computing through
Combinatorial Topology
84
One-Round Protocol Graph
P
0?
01
01
?1
Alice and Bob run together,
she sees his value.
Distributed Computing through
Combinatorial Topology
85
One-Round Protocol Graph
P
0?
01
01
?1
Alice finishes, then Bob starts
Distributed Computing through
Combinatorial Topology
86
One-Round Protocol Graph
P
0?
01
01
?1
Alice and Bob run together
Distributed Computing through
Combinatorial Topology
87
One-Round Protocol Graph
P
0?
01
01
?1
Bob can’t tell whether Alice saw him
Distributed Computing through
Combinatorial Topology
88
Execution Carrier Map
I
0
1
¥
0?
01
01
?1
P
Distributed Computing through
Combinatorial Topology
89
Execution Carrier Map
I
0
¥: I ! 2P
0?
1
¥
01
01
P
?1
strict carrier map
¥(¾) Å ¥(¿) = ¥(¾ Å90 ¿)
Distributed Computing through
Combinatorial Topology
The Decision Map
0?
01
01
?1
2/3
1
Protocol graph
δδ
0
1/3
Distributed Computing through
Combinatorial Topology
Output graph
91
All Together
0
1
I
¥
¢
0?
01
01
?1
P
0
1/3
2/3
1
O
δ
Distributed Computing through
Combinatorial Topology
92
Definition
Decision map δ is carried by carrier map ¢ if
for each input vertex s,
δ(¥(s)) µ ¢(s)
for each input edge ¾,
δ(¥(¾)) µ ¢(¾).
Distributed Computing through
Combinatorial Topology
93
Meaning
δ(¥(s)) µ ¢(s)
process strarts in state s
94
Meaning
δ(¥(s)) µ ¢(s)
runs the protocol to completion
95
Meaning
δ(¥(s)) µ ¢(s)
makes a decision …
96
Meaning
δ(¥(s)) µ ¢(s)
decision is permitted by task carrier map
97
Solving a Task
Definition
The protocol (I,P,¥) solves the task (I, O, ¢)
Distributed Computing through
Combinatorial Topology
98
Solving a Task
Definition
The protocol (I,P,¥) solves the task (I, O, ¢)
if there is …
Distributed Computing through
Combinatorial Topology
99
Solving a Task
Definition
The protocol (I,P,¥) solves the task (I, O, ¢)
if there is …
a simplicial decision map
δ:P ! O
Distributed Computing through
Combinatorial Topology
100
Solving a Task
Definition
The protocol (I,P,¥) solves the task (I, O, ¢)
if there is …
a simplicial decision map
δ:P ! O
such that δ is carried by ¢.
(δ agrees with ¢)
Distributed Computing through
Combinatorial Topology
101
Layered Read-Write Model
102
Layered Read-Write Protocol
shared mem array 0..1,0..L of Value
view: Value := my input value;
for i: int := 0 to L do
mem[i][A] := view;
view := view + mem[A] + mem[B];
return δ(view)
Distributed Computing through
Combinatorial Topology
103
Layered Read-Write Protocol
shared mem array 0..1,0..L of Value
view: Value := my input value;
for i: int := 0 to L do
mem[i][A] := view;
As before,
run for+L mem[A]
layers + mem[B];
view
:= view
return δ(view)
Distributed Computing through
Combinatorial Topology
104
Layered Read-Write Protocol
shared mem array 0..1,0..L of Value
view: Value := my input value;
for i: int := 0 to L do
mem[i][A] := view;
view := view + mem[A] + mem[B];
return δ(view)
Each layer uses a distinct, “clean” memory
Distributed Computing through
Combinatorial Topology
105
Layered R-W Protocol Graph
I
0
1
¥
0?
01
01
?1
P
Distributed Computing through
Combinatorial Topology
106
Layered R-W Protocol Graph
I
¥
P
P is always a subdivision of I
Distributed Computing through
Combinatorial Topology
107
Road Map
Elementary Graph Theory
Tasks
Models of Computation
Approximate Agreement
Task Solvability
Distributed Computing through
Combinatorial Topology
108
Alice’s 1/3-Agreement
Protocol
mem[A] := 0
other := mem[B]
if other == ? then
decide 0
else
decide 1/3
Distributed Computing through
Combinatorial Topology
109
Alice’s 1/3-Agreement
Protocol
mem[A] := 0
if mem[B] == ? then
Alice writes her value to memory
decide 0
else
decide 1/3
Distributed Computing through
Combinatorial Topology
110
Alice’s 1/3-Agreement
Protocol
mem[A] := 0
if mem[B] == ? then
decide 0
Ifelse
she doesn’t see Bob’s value, decide her own.
decide 1/3
Distributed Computing through
Combinatorial Topology
111
Alice’s 1/3-Agreement
Protocol
mem[A] := 0
if mem[B] == ? then
decide 0
else
decide 1/3
If she see’s Bob’s value, jump to the middle
Distributed Computing through
Combinatorial Topology
112
0
1/3
2/3
1
0
1/3
2/3
1
0
1/3
2/3
1
Distributed Computing through
Combinatorial Topology
113
One-Layer 1/3-Agreement
Protocol
0
1
I
¥
0?
01
01
?1
P
0
1/3
2/3
1
O
δ
Distributed Computing through
Combinatorial Topology
114
No 1-Layer 1/5-Agreement
Protocol
0
1
I
¥
0?
δ
0
01
01
?1
P
(no map possible)
1/5
2/5
3/5
Distributed Computing through
Combinatorial Topology
4/5
1
O
115
2-Layer 1/5-Agreement
0
1
I
¥
0?
01
layer 1
01
?1
layer 2
¥
δ
0
1/5
2/5
3/5
Distributed Computing through
Combinatorial Topology
4/5
O
1
116
Fact
In the layered read-write model,
The 1/K-Agreement Task
Has a dlog3 Ke–layer protocol
Distributed Computing through
Combinatorial Topology
117
Road Map
Elementary Graph Theory
Tasks
Models of Computation
Approximate Agreement
Task Solvability
Distributed Computing through
Combinatorial Topology
118
Fact
The protocol graph for any L-layer protocol with
input graph I is a subdivision of I, where each
edge is subdivided 3L times.
Distributed Computing through
Combinatorial Topology
119
Main Theorem
The two-process task (I, O, ¢) is solvable in the
layered read-write model if and only if there
exists a connected carrier map ©: I ! 2O
carried by ¢.
Distributed Computing through
Combinatorial Topology
120
Corollary
The consensus task has no layered
read-write protocol
Distributed Computing through
Combinatorial Topology
121
Corollary
Any ²–agreement task has a layered
read-write protocol
Distributed Computing through
Combinatorial Topology
122
This work is licensed under a Creative Commons AttributionShareAlike 2.5 License.
•
You are free:
– to Share — to copy, distribute and transmit the work
– to Remix — to adapt the work
•
Under the following conditions:
– Attribution. You must attribute the work to “Distributed Computing through
Combinatorial Topology” (but not in any way that suggests that the authors
endorse you or your use of the work).
– Share Alike. If you alter, transform, or build upon this work, you may
distribute the resulting work only under the same, similar or a compatible
license.
•
For any reuse or distribution, you must make clear to others the license
terms of this work. The best way to do this is with a link to
– http://creativecommons.org/licenses/by-sa/3.0/.
•
•
Any of the above conditions can be waived if you get permission from
the copyright holder.
Nothing in this license impairs or restricts the author's moral rights.
123
Distributed Computing through
Combinatorial Topology