• Aucun résultat trouvé

Leader election

N/A
N/A
Protected

Academic year: 2022

Partager "Leader election"

Copied!
26
0
0

Texte intégral

(1)

Leader election

(2)

Leader election

Definition : Given a set of processes choose an unique leader (safety) in a finite time (liveness).

Applications :

• radio and wifi networks

• wired networks

• spanning tree construction

• cloud or client-server architectures

(3)

Leader election

Th. There is no deterministic algorithm for leader election in anonymous and uniform networks.

Proof idea:

1. The network is anonymous and the initial configuration is symmetric ;

2. The objectif configuration (with an elected leader) is asymmetric ;

3. There is an execution such as the system goes from a

symmetric configuration into an asymmetric

configuration and vice-versa.

(4)

Leader election

• Bypass the impossibility results :

– use of identifiers

• Chang et Roberts

• Hirshberg-Sinclair

• Diffusion

– use of randomness

• Itai et Rodeh

(5)

Chang-Roberts algorithm

(6)

Chang&Roberts algorithm

Topology : unidirectional ring (each site «i»

has a pointeur vers to its successeur succ[i])

Idea : each candidate sends along the ring its

candidature ; the process with the maximal

identifier wins

(7)

Algorithme Chang-Roberts

Candidature site «i»

candidat_i = true

send <CHEF,i> to succ[i] /* i sends its candidature

Reception at site «i» of message <CHEF,j> sent by site «j»

Case

j>i: send <CHEF,j> to succ[i]

j<i: if not candidat_i

candidat_i=true; send <CHEF,i> to succ[i]

j=i: diffusion <CHEF, i> /* send to all the election result

(8)

Chang-Roberts - example

0

4 3

2

0

4 3

2 0

4 3

2

0

4 3

2

(9)

Complexity   Best case : O(n)

Identifiers ordered in an increasing order around the ring.

1

2 4

3

(10)

Complexity  

Worst case : O(n 2 )

The identifiers are ordered in a decreasing order around the ring

Identifier « i » visits i before its status is

decided 4

3 1

2

(11)

Complexity  

Average : O(nlog(n))

★ Identify all the possibilities to arrange identifiers around the ring : (n-1)!

★ Let X_k denote : the number of messages if the election would start at node k

★ E[ ∑X_k ] = ∑ E[X_k] for k going

from 1 to n

(12)

«Diffusion»

(13)

«Diffusion 1»

Idea :

– each candidate sends its identity to the other nodes in the network

– a site responds to all nodes having an identifier inferior of itself

– a process that does not receive a response its the leader

Hypotheses : reliable communication and

synchronous (upper bound on the communication

time known)

(14)

«Diffusion 2»

Idea :

– each candidate sends its identity to the other nodes in the network and waits for the identity of the other sites

– compute max/min over the set of identities received

Hypothesis : reliable communication and knowledge

of the number of processes in the network

(15)

Hirschberg-Sinclair algorithm

(16)

Hirschberg-Sinclair

• Topology : bidirectional ring

• the algorithm works in rounds

• only the processes which win the round

« r » play for round « r+1 »

• Algorithm: P i is the leader of round « r » if

and only if P i has the maximal identifier

in the set of nodes at distance at most 2 r

from P i

(17)

Hirschberg-Sinclair

• Initially:

– all processus sont leaders

• Round 0:

– 6 , 7 et 8 leaders

• Round 1:

– 7, 8 leaders

• Round 2:

– 8 the unique leader

– at most log(N) rounds

(18)

Itai-Rodeh algorithm

(19)

Algorithme Itai-Rodeh

• use Chang&Roberts algorithm

• each process chooses a random id in 1..n (two processes can choose the same id)

• each process candidate sends a message with to fields : – “counter” initially equal to 1

– “another” initially equal to false (as soon as the message meets a candidat with the same id, “another” sets to true)

• leaders at round “i” reexecute the algorithm

• the algorithm finishes with probability 1

(20)

Leader Election   Applications

20

(21)

Spanning tree construction (diffusion)

• a single spanning tree is constructed (safety) in a finite time (liveness)

• leader-based solution

– the leader starts the construction by sending message M

to its neighbors ; on the reception of a message a process

takes as father in the tree the sender and diffuses the

message to its neighbors except its father.

(22)

Spanning tree construction (diffusion)

• Structures :

– Parent : pointer to the parent node in the tree (initially NULL)

– Children : set of children (initially empty)

– Others : neighbors which are not children (initially

empty)

(23)

Spanning tree construction (diffusion)

1 2

3

5 4

6 7

Site i initiator

if leader and parent=NULL then send M to neighbors; parent=i

Site i receive message M from site j if parent=NULL then

parent=j

send <parent> to j

send M to neighbors k, such that k≠j

else send <reject> to j

Site i receives <parent> from site j children=children U {j}

if children U others=voisins \ {parent} then

end

Site i receives <reject> from site j others=others U {j}

if children U others=voisins \ {parent} then

end

(24)

Spanning tree construction (diffusion)

Site i initiator

if leader and parent=NULL then send M to neighbors; parent=i

Site i receive message M from site j if parent=NULL then

parent=j

send <parent> to j

send M to neighbors k, such that k≠j

else send <reject> to j

Site i receives <parent> from site j children=children U {j}

if children U others=voisins \ {parent} then

end

Site i receives <reject> from site j others=others U {j}

if children U others=voisins \ {parent} then

end

1 2

3

5 4

6 7

Others(6)={5}

Others(5)={7,6}

Others(3)={4}

Others(4)={3}

Others(7)={5}

(25)

Applications

• compute the size of a network

• publish/subscribe

• mutual exclusion

• access to the replicated data

• consensus

• termination detection

• deadlock situation

(26)

Conclusion

• Robot networks, wifi, sensor

– randomization

• P2P

– difficult to implement leader election because of

churn

Références

Documents relatifs

• Line block, Page block, and Unprotected block transfer modes · Four separate programmable function keys (eight functions) • Line drawing graphics characters •

1 – Priming represents a form of subliminal activity by means of which the individual is prepared cognitively to influ- ence the reception of the message as such as well as of

As in the previous study, our manipulations were successful. incompetent) 6 2 (gender of the participant) ANOVAs for perceived leader dominance (H1), subordinate dominance

In order to prevent file naming conflicts on shared disks at File Processors, different users of a shared volume are placed into different subdirectories at

A recent report 3 not included in the Prescrire article 1 indicates that 4 weeks of treatment with montelukast decreases air way eosinophilic inflammation in addition to

This information is intended for use when the VPIM message format is used for storing &#34;Call Answer&#34; voice messages in an Internet Mail message store, i.e., the

This document defines a certificate extension for inclusion of S/MIME Capabilities in X.509 public key certificates, as defined by RFC 3280 [RFC3280].. The S/MIME

The final programme is very rich, encompassing the long and short presentations of the accepted original contributions and published works, as well as the 7 posters.. We are indebted