Download presentation

Presentation is loading. Please wait.

Published byTyler Catchpole Modified over 2 years ago

1
Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens

2
Distributed Computing Distributed computing is decentralised and parallel computing, where two or more processors communicate over a network to accomplish a common task. The collaborating processors are often identical. One of the central problems is…

3
Leader Election Given a network of processors, exactly one processor should output the decision that it is the leader. It is usually required that all non-leader processors are informed of the leader’s election.

4
The Synchronous Network Model

5
Network representation Directed Graph G(V,E), |V|= n Nodes represent processors Edges represent (directed) communication channels Message Passing System Global Clock (for every tic a step of the algorithm is executed)

6
Processor’s fields Every processor consists of the following: states i (a not necessarily finite set of states) start i (the initial state) msgs i (a message generation function) trans i (a state transition function)

7
Step 1.Apply the message generation function to the current state to generate the messages to be sent to all outgoing neighbors. 2.Apply the state transition function to the current state and the incoming messages to obtain the new state.

8
Complexity measures Time complexity: the number of the steps until all outputs are produced or all the processors halt. Communication complexity: the number of non-null messages that are sent during the execution.

9
Leader Election in Rings with UIDs

10
Setting The network graph is a directed ring consisting of n nodes (n is unknown to the processors). Processors run the same deterministic algorithm. The only piece of information supplied to the processors is a unique integer identifier (UID).

11
Related Work and Important Results AlgorithmTime Complexity Msg Complexity LCR (‘79)O(n)O(n 2 ) HS (’80)O(n)O(nlogn) Our AlgorithmO(n)O(nlogn) (better constant) Lower boundΩ(n) (trivial)Ω(nlogn) FL (’87)

12
Our Algorithm

13
Basic Idea Every processor starts by sending a message with its UID Nodes which receive a UID greater than their own take on the task of forwarding it around the ring, while the node which initially possessed it becomes inactive. The processor that will become the leader is the one with the greatest UID and this will happen when its UID returns to itself after traveling around the ring.

14
Description Every processor has the following fields: Its own UID The greatest UID it has seen so far One activity field {active, inactive, waiting} One status field {leader, unknown}

15
Description The algorithm is executed in phases 0, 1, 2... Every phase k has two parts

16
First Part of Phase k Every active processor i sends a token with the greatest UID it has seen so far to travel for distance at most 2 k.

17
First Part of Phase k When a processor receives a UID that is equal to its own UID, it declares itself the leader. If this is not the case then it compares it with the greatest UID it has seen so far.

18
First Part of Phase k If the incoming UID is smaller then it discards it. If the incoming UID is greater then –It saves this UID as the greatest it has seen so far. –Either it becomes waiting if it is the incoming UID’s end of path (it has already traveled distance 2 k ), or it passes it to the next processor and becomes inactive.

19
Second Part of Phase k After this time (2 k ), if i is still active resends the UID to travel distance 2 k and becomes inactive. If a waiting processor receives again the same UID after 2 k time then it becomes active. If not it becomes inactive. The next phase k+1 begins…

20
A Simple Example

28
A More Complicated Example

86
Complexity Analysis

87
Execution Time Total running time = time until maximum UID reaches its initiator (one round = n steps) But how many phases will be executed until maxUID reaches its initiator?

93
Number of Phases f = total number of phases. 1 + 2 + 4 + … + 2 f-1 < n → 2 f – 1 < n 2 f+1 – 1 ≥ n So f ≈ logn

94
Time Complexity In every phase i: 2 parts 2 i steps each part Total running time 2 + 4 + 8 + … + 2 f + rest ≤ ≤ 2 f+2 – 2 = O(2 logn ) = = O(n) 2 i+1 steps

95
Messages Only an active processor can initiate a message. Inactive processors pass the message to the final receiver

111
2 i +1

112
In phase i+1 2 i +1 → 1 active processor n → (n / 2 i +1) active processors Every active processor causes 2∙2 i+1 = 2 i+2 messages to be sent. Total number of messages in this phase: (n / 2 i +1) ∙ 2 i+2 ≈ 4n

113
Message Complexity Total number of phases ≈ logn Number of messages in every phase ≈ 4n The total number of messages during the execution is O(nlogn) with a constant factor 4 (improving a previous constant factor 8 in HS).

114
Complexity Time Complexity: O(n) Message Complexity: O(nlogn) For non-leader results we need n extra steps and n extra messages.

115
THANK YOU!

116
Leader Election in Anonymous Rings

117
General Lemma: If the network is symmetric (i.e. a ring) and anonymous (the processors 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.

118
Itai and Rodeh Algorithm Assumption: processors know n. The Algorithm The algorithm proceeds in phases, each of them containing n steps. At every phase, a ≤ n processors are active (initially everyone). During each phase some processors may become inactive. At the beginning of every phase, every active processor decides with probability a -1 whether or not to become a candidate. To do that, it picks a random number r, 0

119
Itai and Rodeh Algorithm To compute the number of candidates (c), each processor counts the pebbles it has seen. Number of pebbles counted = Number of candidates. At the end of the phase, every processor has calculated c. If c=1 then sole candidate becomes leader. If c>1 then a new phase begins with the new active processors (the candidates of the previous phase). If c=0 the phase was useless.

120
Itai and Rodeh Algorithm 0.04 0.35 0.46 0.08 0.37 0.83 0.64 0.220.53 0.93 a -1 = 1/10 c = 2

121
Itai and Rodeh Algorithm 0.74 0.88 Useless phase a -1 = 1/2 c = 2

122
Itai and Rodeh Algorithm 0.32 0.69 a -1 = 1/2 c = 1

123
Itai and Rodeh Algorithm The leader!!!

124
Itai and Rodeh Algorithm- Complexity Analysis p(a,c) : the probability that c out of a active processors become candidates. Then Proof: X i a random variable, X i =1 if i becomes a candidate, else 0 (bernoulli trial) Then X=Σ n X i = the number of processors become candidates. X~binomial distribution. Thus

125
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 processors that become candidates). E[X ] = E[Σ a X i ] = Σ a (E[X i ]) = a · a -1 = 1 Thus, the expected message complexity per phase is n.

126
Itai and Rodeh Algorithm- Complexity Analysis Theorem: The expected number of phases required to reduce the number of active processors from a to 1 l(a) converges to 2.441716… Proof sketch:

127
Itai and Rodeh Algorithm- Complexity Analysis For fixed c, L(a,c) converges, L(,c) converges,. Thus, So, L ≈ 2.441716

128
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 processors that become candidates). E[X ] = E[Σ a X i ] = Σ a (E[X i ]) = a · a -1 = 1 Thus, the expected message complexity per phase is n.

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google