Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General...
Transcript of Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General...
![Page 1: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/1.jpg)
1/66
Distributed Leader Election Algorithms in Synchronous Networks
Mitsou
ValiaNational Technical University of Athens
School of Applied Mathematics and Physics
![Page 2: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/2.jpg)
2/66
Distributed Computing
Distributed computing is decentralised and parallel computing, using two or more computers communicating over a network to accomplish a common task.
The collaborating processes are often identical. One of the central problems is…
![Page 3: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/3.jpg)
3/66
Leader Election
Given a network of processes, exactly one process should output the decision that it is the leader.
It is usually required that all non-leader processes are informed of the leader’s election.
![Page 4: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/4.jpg)
4/66
Networks
•
The timing model:–
Synchronous
–
Asynchronous–
Partially synchronous
•
The failure model:–
Completely reliable
–
Partly faulty•
Stopping failure
•
Byzantine failure
![Page 5: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/5.jpg)
5/66
The Synchronous Network Model
•
Directed Graph G(V,E), |V|=n•
Nodes represent processes
•
Edges represent (directed) communication channels
![Page 6: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/6.jpg)
6/66
The Synchronous Network Model (formal)
•
Alphabet M (null indicates the absence of a message)
•
On every i Є
V we have a process which consists:–
statesi
(a not necessarily finite set of states)–
starti
(the initial state)–
msgsi
(a message generation function)
–
transi
(a state transition function)
•
With each edge i, j there is a link that can hold at most a single message in M.
![Page 7: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/7.jpg)
7/66
Complexity measures
•
Time complexity: the number of the rounds until all outputs are produced or all the processes halt.
•
Communication complexity: the number of non- null messages that are sent during the
execution.
![Page 8: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/8.jpg)
8/66
Leader Election in a Synchronous Ring
![Page 9: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/9.jpg)
9/66
Setting•
The network graph is a directed ring (unidirected
or
bi-directed) consisting of n nodes (n may be unknown to the processes).
•
Processes run the same deterministic algorithm
•
The only piece of information supplied to the processes is a unique integer identifier (UID).
•
UIDs
may be used –
In comparisons only (comparison-based algorithms)
–
In comparisons and other calculations (non-comparison- based).
![Page 10: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/10.jpg)
10/66
Related Work and Important Results
Algorithm Time Complexity Msg
Complexity Restrictions
LCR (‘79) O(n) O(n2) -HS (’80) O(n) O(nlogn) Bidirectional
ML (’06) O(n) O(nlogn) (better constant) -
TimeSlice O(n · umin
) O(n)Non-
comparison based
Lower bound Ω(n) (trivial) Ω(nlogn) FL (’87)
![Page 11: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/11.jpg)
11/66
The LCR Algorithm
•
Comparison-based Algorithm•
The size of the ring is unknown to the processes
•
Unidirectional Ring•
It elects the process with the maximum UID
![Page 12: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/12.jpg)
12/66
The LCR Algorithm
DescriptionEach process sends its UID around the ring.When a process receives a UID, it compares this one to its own.–
If the incoming UID is greater, then it passes this UID to the next process.
–
If the incoming UID is smaller, then it discards it.
–
If it is equal, then the process declares itself the leader.
![Page 13: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/13.jpg)
13/66
LCR Example
4
1
8
5
3
7
6
2
![Page 14: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/14.jpg)
14/66
LCR Complexity Analysis
•
Time Complexity: O(n)•
Message Complexity: O(n2) –
worst case
O(nlogn) –
average case
![Page 15: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/15.jpg)
15/66
The HS Algorithm
•
Comparison-based Algorithm•
The size of the ring is unknown to the processes
•
Bi-directional Ring•
It elects the process with the maximum UID
![Page 16: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/16.jpg)
16/66
The HS Algorithm
DescriptionEach process operates in phases 0, 1, 2... In each phase k, process i sends tokens with its UID in both directions to travel distance 2k
and
return back to it.If both tokens return then process i continues in phase k+1.
![Page 17: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/17.jpg)
17/66Figure: The execution of the HS
![Page 18: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/18.jpg)
18/66
The HS Algorithm (continued)
When a process receives an outgoing UID, it compares this one with its own.–
If the received UID is smaller, then it discards it.
–
If the received UID is greater then•
it passes it to the next process, if it is not the end of its path,
•
else it returns it back to the previous one (to travel back to the originating process).
–
If it is equal, then the process declares itself the leader.
![Page 19: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/19.jpg)
19/66
HS Example (phase 0)
All the 20 nodes
![Page 20: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/20.jpg)
20/66
HS Example (phase 1)
•
15•
19
•
20•
18
•
16•
12
•
17
![Page 21: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/21.jpg)
21/66
HS Example (phase 2)
•
15•
20
•
18•
16
•
17
![Page 22: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/22.jpg)
22/66
HS Example (phase 3)
•
20•
17
![Page 23: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/23.jpg)
23/66
HS Example (phase 4)
•
20
![Page 24: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/24.jpg)
24/66
HS Example (phase 5)
20 is theLEADER
![Page 25: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/25.jpg)
25/66
Complexity Analysis
•
Time Complexity: O(n)•
Message Complexity: O(nlogn)
![Page 26: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/26.jpg)
26/66
Distributed Algorithms in a General Synchronous Network
![Page 27: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/27.jpg)
27/66
Leader Election in a General Network - The FloodMax
Algorithm
•
The diam
of the graph is known.•
Causes both leader and non-leaders to identify themselves.
•
It elects the process with the maximum UID.
![Page 28: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/28.jpg)
28/66
FloodMax Algorithm
•
Every process keeps the maximum UID it has seen so far (initially its own).
•
At each round, each process sends this maximum value to every outgoing neighbor.
•
After diam
rounds if the maximum value is the process’s UID then it elects itself the leader, otherwise it is a non-leader.
![Page 29: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/29.jpg)
29/66
Complexity Analysis
•
Time Complexity: diam
rounds
•
Communication Complexity: diam·|E| (|E| messages in every round).
![Page 30: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/30.jpg)
30/66
Minimum Spanning TreeSpanning tree of a graph G(V,E): a tree that consists
entirely of edges in E and contains every vertex of G.
The problem: Given an undirected graph G(V,E) find a minimum weight (undirected) spanning tree for the network.
Distributed output: Each process should determine which of its incident edges belong to the tree.
•
Processes know n•
Processes have UIDs
![Page 31: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/31.jpg)
31/66
Minimum Spanning Tree (continued)
General Strategy for MST:•
Start with the trivial spanning forest.
•
For every connected component C select a minimum weight outgoing edge e.
•
Combine C with the component at the other end of e, including e.
•
Stop when the forest has a single component.
![Page 32: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/32.jpg)
32/66
Minimum Spanning Tree (continued)
Several well-known sequential MST algorithms are special cases of this general strategy:
•
Prim (add minimum-weight outgoing edge from the current component attaching a new single node)
•
Kruskal
(add minimum-weight edge that joins two separated parts)
![Page 33: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/33.jpg)
33/66
Minimum Spanning Tree (continued)
A distributed version could be: Each component determines a minimum-weight outgoing edge and all these edges are added to the forest causing combinations of components all at once.
The above strategy is false in general!!!Example: A cycle could be created.
Lemma: If all edges of G have distinct weights, then there is exactly one MST.
1
1
1
![Page 34: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/34.jpg)
34/66
Minimum Spanning Tree (continued)
The SynchGHS algorithm(Based on an asynchronous algorithm developed
by Gallager, Humblet
and Spira
in 1983.)
The strategy mentioned before is used.
Assumption: Edge weights are all distinct.
![Page 35: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/35.jpg)
35/66
Minimum Spanning Tree (continued)
The Algorithm:•
The algorithm builds components in levels.
•
For each level k, the level k components are subtrees
of the MST that constitute a spanning
forest.•
Each level k component has at least 2k
nodes.
•
Every component at every level has a distinguished leader node.
![Page 36: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/36.jpg)
36/66
Minimum Spanning Tree (continued)
101
2
9
8
7
6
3
4
5
1
5
3
17
134
10
14
9
15
7
12
6
11
2
16
8
![Page 37: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/37.jpg)
37/66
Minimum Spanning Tree (continued)
17
11
101
2
9
8
7
6
3
4
5
1
5
313
4
10
14
9
15
7
12
6
2
16
8
![Page 38: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/38.jpg)
38/66
Minimum Spanning Tree (continued)
17
11
101
2
9
8
7
6
3
4
5
1
5
313
4
10
14
9
15
7
12
6
2
16
8
![Page 39: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/39.jpg)
39/66
Minimum Spanning Tree (continued)
17
11
101
2
9
8
7
6
3
4
5
1
5
313
4
10
14
9
15
7
12
6
2
16
8
![Page 40: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/40.jpg)
40/66
Minimum Spanning Tree (continued)
Complexity Analysis•
Time Complexity: O(nlogn) [logn
levels] x [O(n) time for every level for
synchronization].
•
Communication Complexity: O((n+|E|)logn)[logn
levels] x [O(n) messages along tree edges
+ O(|E|) messages for finding the local minimum weight outgoing edges].It can be reduced to O(nlogn
+ |E|).
![Page 41: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/41.jpg)
41/66
Minimum Spanning Tree (continued)
Non-unique weight edges:edge identifier: a triple (weighti,j , u, u’)where, u<u’ the UIDs
of i, j.
Thus, a total ordering is defined among the edge identifiers.
Example:1
3
2(1,1,2)
(1,1,3) (1,2,3)
![Page 42: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/42.jpg)
42/66
Minimum Spanning Tree (continued)
Leader Election: •
The leaves of the MST begin a convergecast
along the
paths of the tree.•
Internal nodes wait to receive messages from all but one neighbor. Then they send a message to the remaining neighbor.
•
If a node receives messages from every neighbor without having itself send a message then becomes the leader.
•
If two neighboring nodes receive messages from each other at the same round, then the one with the greatest UID becomes the leader.
Complexity: n-1 additional time and messages.
![Page 43: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/43.jpg)
43/66
Leader Election in Anonymous Rings
![Page 44: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/44.jpg)
44/66
General
Lemma: If the network is symmetric (i.e. a ring) and anonymous (the processes haven’t UIDs) then it is impossible to elect a leader by a deterministic algorithm. [by Angluin
(1980)]
Probabilistic algorithms are used to break symmetry.
![Page 45: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/45.jpg)
45/66
Itai and Rodeh AlgorithmAssumption: Processes know n.
The Algorithm•
The algorithm proceeds in phases, each of them containing n rounds.
•
At every phase, a ≤
n processes are active (initially everyone). During each phase some processes may become inactive.
•
At the beginning of every phase, every active process decides with probability a-1
whether or not to become a
candidate.To do that, it picks a random number r, 0<r<1 and if r<a-1, then it becomes a candidate and initiates a pebble to travel around the ring.
![Page 46: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/46.jpg)
46/66
Itai and Rodeh Algorithm
•
To compute the number of candidates (c), each process counts the pebbles it has seen. Number of pebbles counted = Number of candidates.
•
At the end of the phase, every process has calculated c.•
If c=1 then sole candidate becomes leader. If c>1 then a new phase begins with the new active processes (the candidates of the previous phase). If c=0 the phase was useless.
![Page 47: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/47.jpg)
47/66
Itai and Rodeh Algorithm
0.04
0.35
0.46
0.08
0.37
0.83
0.64
0.22 0.53
0.93
a-1
= 1/10
c = 2
![Page 48: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/48.jpg)
48/66
Itai and Rodeh Algorithm
0.74
0.88
Useless phasea-1
= 1/2
c = 2
![Page 49: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/49.jpg)
49/66
Itai and Rodeh Algorithm
0.32
0.69
a-1
= 1/2
c = 1
![Page 50: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/50.jpg)
50/66
Itai and Rodeh Algorithm
The leader!!!
![Page 51: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/51.jpg)
51/66
Itai and Rodeh Algorithm- Complexity Analysisp(a,c) : the probability that c out of a active processes
become candidates. Thenca
c
aa
ca
cap−
− ⎟⎠⎞
⎜⎝⎛ −⎟⎟
⎠
⎞⎜⎜⎝
⎛=
11),(
Proof:Xi
a random variable,
Xi
=1 if i becomes a candidate, else 0 (bernoulli
trial)
Then X=ΣnXi
= the number of processes become candidates. X~binomial distribution.
Thus [ ] ( ) ),(1 1 capaaca
cXP cac =−⎟⎟⎠
⎞⎜⎜⎝
⎛==
−−−
⎩⎨⎧
−=
−
−
1
1
1,0,1
aa
X i
![Page 52: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/52.jpg)
52/66
Itai and Rodeh Algorithm- Complexity Analysis
Average Case
•
Time Complexity: 2.441716 ·
n•
Message Complexity: 2.441716 ·
n
The number of pebbles initialized per phase is X (the number of active processes that become candidates).E[X ] = E[ΣaXi ] = Σa(E[Xi ]) = a ·
a-1
= 1
Thus, the expected message complexity per phase is n.
![Page 53: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/53.jpg)
53/66
Leader Election Protocols with Cheating Processes
![Page 54: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/54.jpg)
54/66
The Model
Full- or Perfect-Information Model [BL 90]:•
There is an adversary that controls t players
•
The adversary has unlimited computational power.
•
Communication between players is by broadcast.
•
Reliable delivery of messages.•
The identity of the sender is protected.
The adversary has complete knowledge of the state of the protocol at any given moment.
![Page 55: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/55.jpg)
55/66
The Network
We assume an asynchronous network with synchronization points :
•
Computation proceeds in rounds.•
In each round processes send messages.
•
During a round we can’t force processes to act simultaneously.
•
Messages of round i precede those of round i+1.
Within a round, all cheaters have the opportunity to wait until they receive messages from all honest players and then send their own.
![Page 56: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/56.jpg)
56/66
ExampleA Leader Election Protocol of n processes (Baton
Passing [Saks 89]):•
In every round the baton is randomly passed to a process that hasn’t yet received it.
•
The last process left with the baton becomes the leader.
If there are cheaters, when they take the baton they give it to an honest process, in order to increase the probability of a cheater to be elected.
Baton Passing lasts n-2 rounds.
nnn
nniP 1
21 ·
32
12 · 1)( =
−−−
= L
![Page 57: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/57.jpg)
57/66
Failure probability
Let P(n,t) be a leader election protocol between n processes, t of which are corrupted.
failP (n,t):
the probability that one of the cheaters is elected.
Proposition:
For any n, any t ≥
1 and any leader election protocol P :
1.
failP
(n,t) is non-decreasing in t.
2.
failP
(n,t) ≥
t/n
3.
failP
(n,n/2) =1
![Page 58: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/58.jpg)
58/66
Resilience
Resilience: How many cheaters are allowed in order for the protocol to guarantee that an honest player can be elected with positive probability.
Definition: P is resilient for t=b(n) iff ε>0 such that for all suitably large n
failP (n,b(n)) ≤
1 –
ε.However,If t ≥
1 then failP (n,t)>1/4
(P is the Lightest Bin protocol which achieves optimal resilience)
∃
n/2n/2 tt
11
fail(n,t)fail(n,t)
11--εε
b(n)b(n)
![Page 59: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/59.jpg)
59/66
Cheaters’ Edge
Cheaters’
edge: The factor that failP (n,t) increases by cheating.
(Antonakopoulos
2006)
Definition: edgeP (n,t) = n/t ·
failP (n,t)-1 (≥0)
Example: Assume a fair leader election protocolIf edge = 1 n/t ·
failP (n,t)
–
1 = 1
n/t ·
failP (n,t)
= 2 failP (n,t) = 2 ·
t/n
⇒⇒
⇒⇒
⇒
![Page 60: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/60.jpg)
60/66
Zero Edge Protocols
Zero Edge Protocols: Protocols where cheaters cannot increase their probability of election by cheating.
•
These protocols exist only for t=1.•
For t>1 the adversary can find two players that can collude.
Example: Baton Passing (t=1)Counter Example: Itai
-
Rodeh
![Page 61: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/61.jpg)
61/66
Zero Edge Protocols
The selected square determines the leader.
A cannot increase the probability of his election. Same for B
and C .
A picks a rowB picks a columnC picks a level D, E are mute.
![Page 62: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/62.jpg)
62/66
Related Work and Important Results
Probabilistic arguments have established that:1.
There exists a leader election protocol AN1 with bounded cheaters’ edge for all t ≤
n.
[Alon, Naor, ‘93].2.
For any β < 1/2, there exists a protocol that is resilient for t = βn. [AN93, BN00] (In terms of resilience, this is optimal.)
Disadvantages•
Non-constructive. Exhaustive search may be
attempted, but could take time .•
O(n) running time (very slow)
)(22nO
![Page 63: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/63.jpg)
63/66
Related Work and Important Results - Reduction via Committees
Lemma: From a leader election protocol P(n,t) executed in r(n) rounds and constructed in s(n) time, we can obtain a leader election protocol cmt|P(logdn, (t/n + c/logn) logdn),
that lasts r(logdn)+1
rounds
and is constructible in s(logdn)+poly(n) time.
[Russel
-
Zuckerman
’01]
![Page 64: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/64.jpg)
64/66
Related Work and Important Results
General scheme to overcome this
drawback:
1.
Players pick a small committee.
2.
Committee members pick a leader among them
using a suitably “good” protocol, discovered via
exhaustive
search (so it doesn’t have to be
efficiently
constructible).
After long line of work, achieved (log*n
+ O(1))-round protocols, with optimal resilience.
[Russel, Zuckerman
’01], [Feige
‘99].
None of them has bounded cheaters’ edge.
![Page 65: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/65.jpg)
65/66
Related Work and Important ResultsAntonakopoulos
(2006) presented three leader election
protocols with bounded cheaters’ edge that are poly(n)-time constructible:
Protocol Condition roundsP* t ≤
Θ(n/logn) 5
P# t ≤
Θ(n/√(lognloglogn)) 5logn
P+ - polylogn
![Page 66: Distributed Leader Election Algorithms in …vmitsou/leader.pdfDistributed Algorithms in a General Synchronous Network 27/66 Leader Election in a General Network - The FloodMax Algorithm](https://reader036.fdocuments.net/reader036/viewer/2022063017/5fd854e860d23a14b747327b/html5/thumbnails/66.jpg)
66/66