efficient algorithms for leader election in radio networks tomasz jurdziński mirosław kutyłowski...

43
Efficient Algorithms Efficient Algorithms for Leader Election in for Leader Election in Radio Networks Radio Networks Tomasz Jurdziński Tomasz Jurdziński Mirosław Kutyłowski Mirosław Kutyłowski Jan Zatopiański Jan Zatopiański

Post on 21-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Efficient Algorithms for Leader Efficient Algorithms for Leader Election in Radio NetworksElection in Radio Networks

Tomasz JurdzińskiTomasz Jurdziński

Mirosław KutyłowskiMirosław Kutyłowski

Jan ZatopiańskiJan Zatopiański

Page 2: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Adversary Immune Leader Adversary Immune Leader Election in Ad Hoc RNElection in Ad Hoc RN

Mirosław KutyłowskiMirosław Kutyłowski

Wojciech RutkowskiWojciech Rutkowski

Page 3: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

IntroductionIntroduction

What are Radio networks? What are Radio networks?

Why elect a leader? Why elect a leader?

Who is the adversary?Who is the adversary?

Page 4: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Radio Networks (RN)Radio Networks (RN)

• Hand-held devices running on batteries with Hand-held devices running on batteries with no central control.no central control.

• The set of activated stations is unknown - The set of activated stations is unknown - the network has to organize itselfthe network has to organize itself

• No infrastructure - useful in disaster-relief, No infrastructure - useful in disaster-relief, law-enforcement, logistics, etc.law-enforcement, logistics, etc.

• Crucial to design efficient algorithms for Crucial to design efficient algorithms for fundamental tasks.fundamental tasks.

Page 5: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

RN ModelRN Model

• StationsStations are computers equipped with radio are computers equipped with radio transceivers. The stations of a RN are transceivers. The stations of a RN are identical and execute the same codeidentical and execute the same code

• They work synchronously (GPS): We split They work synchronously (GPS): We split the execution time into time slots, called the execution time into time slots, called stepssteps

• There is a single communication channel There is a single communication channel available to all stationsavailable to all stations

Page 6: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

CollisionsCollisions

• During a step a station may either send (broadcast) During a step a station may either send (broadcast) a message or listen to the channela message or listen to the channel

• If exactly one station sends, then all stations that If exactly one station sends, then all stations that listen at this moment receive the message sentlisten at this moment receive the message sent

• If at least two stations send, then a If at least two stations send, then a collision collision occursoccurs• A collision is indistinguishable from the situation A collision is indistinguishable from the situation

when no station is sending: when no station is sending: no collision-detection no collision-detection (no-CD)(no-CD)

Page 7: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

MessagesMessages

• The size of the message sent by a station in one The size of the message sent by a station in one step is not limited.step is not limited.

• If a station sends a message during step i and no If a station sends a message during step i and no other station is sending at this moment, then we other station is sending at this moment, then we say that the station say that the station succeeds succeeds and that step i is and that step i is successfulsuccessful

• An active station might be either An active station might be either awake awake or or asleepasleep: : In the first case, a station sends a message or In the first case, a station sends a message or listens to the communication channellistens to the communication channel

Page 8: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Leader Election ProblemLeader Election Problem

• A RN network is given, such that each A RN network is given, such that each active station has no knowledge which active station has no knowledge which stations are active (except itself). Initialize stations are active (except itself). Initialize the network so that the network so that exactly exactly one station gets one station gets status status leader leader and the rest of the active and the rest of the active stations receive the status stations receive the status nonleadernonleader..

Page 9: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Randomized Leader ElectionRandomized Leader Election

• Two kinds of randomized RN algorithms Two kinds of randomized RN algorithms are considered:are considered:• Either The number of active stations is Either The number of active stations is

unknown, orunknown, or• This number is known or can be approximatedThis number is known or can be approximated

• The stations have no ID's or serial numbers The stations have no ID's or serial numbers - these have to be assigned during - these have to be assigned during initialization processinitialization process

Page 10: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Deterministic Leader ElectionDeterministic Leader Election

• Station ID's are necessary for symmetry Station ID's are necessary for symmetry breakingbreaking

• We assume The stations have unique ID We assume The stations have unique ID numbers from the range [1...numbers from the range [1...nn]]

• An arbitrary number of ID's might be used An arbitrary number of ID's might be used by active stationsby active stations

Page 11: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Complexity measuresComplexity measures

• There are two main complexity measures for RN There are two main complexity measures for RN algorithms: algorithms: time complexity time complexity and and energy costenergy cost

• Time complexity is the number of steps executedTime complexity is the number of steps executed• Energy cost is the maximum over all stations of Energy cost is the maximum over all stations of

the number of steps in which the station is awakethe number of steps in which the station is awake• In the case of probabilistic algorithms we require In the case of probabilistic algorithms we require

that the prescribed energy or time bound is that the prescribed energy or time bound is satisfied with high probability (1/satisfied with high probability (1/nn))

Page 12: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

The AdversaryThe Adversary

• We cannot defend against an adversary We cannot defend against an adversary which jams all communicationswhich jams all communications

• We assume that the adversary has energy We assume that the adversary has energy capacity of O(logcapacity of O(logNN))

• But he knows our protocol, and will try to But he knows our protocol, and will try to defeat it’s goals:defeat it’s goals:• Have no leader electedHave no leader elected• Have more than one leader electedHave more than one leader elected

Page 13: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Example of leader electionExample of leader election

• The simplest leader election algorithm is used by The simplest leader election algorithm is used by Ethernet: with a certain probability each candidate Ethernet: with a certain probability each candidate sends a message (sends a message (a triala trial). If a station sends a ). If a station sends a message and there is no collision, then it becomes message and there is no collision, then it becomes the leader. The step is repeated until a leader is the leader. The step is repeated until a leader is elected.elected.

• The adversary may:The adversary may:• Cause collisions all the time (block)Cause collisions all the time (block)

• Pretend to win, than disappear (no leader)Pretend to win, than disappear (no leader)

Page 14: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Tree Leader Election AlgorithmTree Leader Election Algorithm

1 2 3 4 5 6 7 8

Page 15: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Adversary Failing Leader ElectionAdversary Failing Leader Election

1 2 3 4 5 6 7 8

X

Page 16: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Cryptographic AssumptionsCryptographic Assumptions

• We will assume that the adversary cannot We will assume that the adversary cannot hear our encrypted messages, and cannot hear our encrypted messages, and cannot participate in the algorithm.participate in the algorithm.

• It does know our protocol, and may try to It does know our protocol, and may try to damage it by interfering with damage it by interfering with communications at strategic instancescommunications at strategic instances

Page 17: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Resisting the AdversaryResisting the Adversary

• A participant becomes a A participant becomes a sender sender or a or a receiverreceiver. It . It participates in participates in d d rounds: during a round a rounds: during a round a participant decides to be active with probability participant decides to be active with probability NN-1-1, only one attempt, only one attempt

• The round consists of 3 communication steps: The round consists of 3 communication steps: • sender broadcasts a message, receiver listenssender broadcasts a message, receiver listens

• receiver repeats the message while sender listensreceiver repeats the message while sender listens

• if sender gets its own message, it repeats it, while if sender gets its own message, it repeats it, while receiver is listening (collision detection)receiver is listening (collision detection)

Page 18: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

ResultsResults

• In case there was no collision we say that the pair In case there was no collision we say that the pair of participants succeeds, and we assign to them of participants succeeds, and we assign to them the round number as a temporary IDthe round number as a temporary ID

• the initial selection is resistant against an the initial selection is resistant against an adversary: since we assume that its energy adversary: since we assume that its energy capacity is O(logcapacity is O(logNN), for a sufficiently large ), for a sufficiently large rr = = ΘΘ(log(logNN), the adversary can only reduce ), the adversary can only reduce probability of success in a trial if probability of success in a trial if rr trials are trials are performed.performed.

Page 19: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Log* deterministic leader electionLog* deterministic leader election

for special casesfor special cases

Page 20: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Sharing the LoadSharing the Load

• Large energy consumption occurs only at these Large energy consumption occurs only at these stations that come close to being a leader, The stations that come close to being a leader, The worst one occurs for the leader.worst one occurs for the leader.

• In our algorithm the stations that loose, called In our algorithm the stations that loose, called slavesslaves, take over the tasks of the stations that have , take over the tasks of the stations that have won with them, their won with them, their mastersmasters,, and thereby reduce and thereby reduce the number of steps in which they are awakethe number of steps in which they are awake

• We assume that at the beginning each active We assume that at the beginning each active station has station has 2/c 2/c (virtual)(virtual) slavesslaves

Page 21: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Initial ParametersInitial Parameters

• Our algorithm consists of O(log* n) stages. Our algorithm consists of O(log* n) stages. at the beginning of each stage i:at the beginning of each stage i:• there are there are xxii stations called stations called masters masters participating participating

in the phase, some are in the phase, some are rich, rich, the rest are the rest are passive passive (nonexistent or with not enough slaves)(nonexistent or with not enough slaves)

• there are at least there are at least ccii·x·xii rich mastersrich masters

• each rich master has a group of at least each rich master has a group of at least ssii slaves slaves – – stations that serve this masterstations that serve this master

Page 22: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Stage ProcessStage Process

• during stage i:during stage i:• the masters are split into groups of size 2^sthe masters are split into groups of size 2^s ii, ,

every group of masters elects a leader that every group of masters elects a leader that becomes a master for the next stagebecomes a master for the next stage

• after electing a leader in a group all other after electing a leader in a group all other masters and slaves of the group become slaves masters and slaves of the group become slaves of the leader; leaders with less than of the leader; leaders with less than SSi+i+11 slaves slaves become passivebecome passive

Page 23: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Tree Leader Election AlgorithmTree Leader Election Algorithmwith Slaveswith Slaves

1 2 3 4 5 6 7 8

Page 24: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

EfficiencyEfficiency

• Let xLet x11 = = n, sn, s11 = = 2/c, 2/c, cc11 = C, and the following = C, and the following condition be fulfilled for each i (may be except the condition be fulfilled for each i (may be except the last phase):last phase):

ccii+1 +1 = = ccii/2 , x/2 , xii+1+1 = = x xii/2^s/2^sii , s , sii+1+1 = = ccii+1 +1 · s· si i · 2^s· 2^sii

• ssii grows so that for grows so that for ii = O(log* = O(log*nn) we end up with a ) we end up with a single group and perform the last phase. Energy single group and perform the last phase. Energy cost is O(log*cost is O(log*nn), since each station is awake for ), since each station is awake for O(1) steps during each phase. The execution time O(1) steps during each phase. The execution time of the algorithm is O(of the algorithm is O(nn))

Page 25: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Sublogarithmic Leader ElectionSublogarithmic Leader Election

for general casesfor general cases

Page 26: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Initial StateInitial State

• A group of size n stations with unique IDs A group of size n stations with unique IDs in the range [1..in the range [1..nn]]

• The number of active stations among them The number of active stations among them is arbitraryis arbitrary

• The parameter k (which is an increasing The parameter k (which is an increasing function k : N function k : N N) is responsible for N) is responsible for divide and conquer divide and conquer feature of the algorithm feature of the algorithm and can be tuned separatelyand can be tuned separately

Page 27: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Algorithm Algorithm SSnn((kk) – Phase 1) – Phase 1

• The stations are split into groups of size The stations are split into groups of size kk = = kk((nn)) based on the IDs of the stations. based on the IDs of the stations.

• During step During step ii every active station of the group every active station of the group ii sends a message:sends a message:• no active stations in a group, nothing happensno active stations in a group, nothing happens

• one active station in a group, it can hear its own one active station in a group, it can hear its own messagemessage

• at least two active stations, they recognize that their at least two active stations, they recognize that their messages have been scrambledmessages have been scrambled

Page 28: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Algorithm Algorithm SSnn((kk) – Phase 2) – Phase 2

• In the groups, where there was one active In the groups, where there was one active station, the only active station is a leader. station, the only active station is a leader. These leaders wait until phase 4.These leaders wait until phase 4.

Page 29: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Algorithm Algorithm SSnn((kk) – Phase 3) – Phase 3

• Each group of size Each group of size k(n), k(n), which during phase which during phase 1 had more than one active station, runs 1 had more than one active station, runs recursively algorithm recursively algorithm SSkk((nn))((kk))

• When it is finished, then each leader elected When it is finished, then each leader elected has a slave that is used in Phase 4 for has a slave that is used in Phase 4 for reducing the energy cost of its master by reducing the energy cost of its master by half.half.

Page 30: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Algorithm Algorithm SSnn((kk) – Phase 4) – Phase 4

• A leader is elected from the leaders of A leader is elected from the leaders of Phases 2 and 3, by an execution of Phases 2 and 3, by an execution of SSn/kn/k((nn))((kk)) (with IDs equal to the numbers of the (with IDs equal to the numbers of the groups to which appropriate leaders belong)groups to which appropriate leaders belong)

Page 31: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

EfficiancyEfficiancy

• The energy cost of the algorithm S satisfies The energy cost of the algorithm S satisfies the following relation:the following relation:

EE((SSnn((kk)))) = O(1)+max{ = O(1)+max{ EE((SSnn//kk((nn))((kk)), )),

EE((SSkk((nn))((kk)))) + ½E + ½E((SSn/kn/k((nn))((kk)) })) }• Let t Let t N and N and δδ = 2 = 2-t-t. For a parameter . For a parameter kk((nn) =) =

nnδδ we can check that a solution to this we can check that a solution to this relation satisfies relation satisfies EE((SSnn((kk)) = 0(()) = 0((lognlogn))-t-t))

Page 32: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Fast randomized leader electionFast randomized leader election

Logarithmic time, high probability, Logarithmic time, high probability, log* energy costlog* energy cost

Page 33: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Two PhasesTwo Phases

• there are there are kk trial steps: in each one, each station that trial steps: in each one, each station that has not sent a message yet decides to send with has not sent a message yet decides to send with probability 1/probability 1/nn

• Only the stations that have succeeded during trial Only the stations that have succeeded during trial steps participate in the second phase of the steps participate in the second phase of the algorithm. Each of them has a temporary ID, algorithm. Each of them has a temporary ID, which is the number of a trial step during which it which is the number of a trial step during which it succeededsucceeded

• During this phase, the stations execute the first During this phase, the stations execute the first algorithmalgorithm

Page 34: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

EfficiencyEfficiency

• Each station is awake for O(1) steps during Each station is awake for O(1) steps during the first phase and O(log*n) steps during the first phase and O(log*n) steps during the second phase: energy cost is O(log* n)the second phase: energy cost is O(log* n)

• The algorithm may fail to elect a leader if The algorithm may fail to elect a leader if the number of stations that participate in the the number of stations that participate in the second phase is too smallsecond phase is too small

Page 35: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Probability of SuccessProbability of Success

• The probability that some station succeeds The probability that some station succeeds during the each trial step equals:during the each trial step equals:

NN·1/·1/nn·(1 – 1/·(1 – 1/nn))NN-1-1 NN·(1 – 1/N)·(1 – 1/N)max(max(NN,,nn)) = = ΘΘ(1)(1)• Based on Chernoff Bounds, the number of Based on Chernoff Bounds, the number of

successes is successes is ΘΘ((kk) with probability at least ) with probability at least 1 – 1/1 – 1/nn

Page 36: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Adversary Resistant Leader ElectionAdversary Resistant Leader Election

for a cryptographically safe networkfor a cryptographically safe network

Page 37: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

PreprocessingPreprocessing

• Initial selection seen earlier is executed for Initial selection seen earlier is executed for dd = = vv··k k turns, where turns, where vv = = ΘΘ((loglogNN) and ) and kk = O(log = O(logNN))

• If a round j of initial selection succeeds, then the If a round j of initial selection succeeds, then the stations chosen are denoted by stations chosen are denoted by PPjj and and P'P'jj

• The station The station PPjj is a candidate for the leader in our is a candidate for the leader in our algorithm, algorithm, P'P'jj is required for auxiliary purposes. is required for auxiliary purposes.

• Each of the Each of the vv groups has groups has ΘΘ(log(logNN) pairs of stations ) pairs of stations (high probability)(high probability)

Page 38: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Building ChainsBuilding Chains

• Current Agent tries to contact the next one Current Agent tries to contact the next one • If Current Agent succeeds, the next station If Current Agent succeeds, the next station

becomes the Current Agentbecomes the Current Agent• Otherwise it keeps trying, until energy runs Otherwise it keeps trying, until energy runs

lowlow• If there is no active Agent - the first active If there is no active Agent - the first active

pair becomes Current Agent and starts a pair becomes Current Agent and starts a new chain.new chain.

Page 39: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Building ComunicationBuilding Comunication

• We use communication slots to hinder the We use communication slots to hinder the AdversaryAdversary

• PPaa and and P’P’aa are the agents, trying to communicate are the agents, trying to communicate with with PPjj and and P’P’jj

• The agent The agent PPaa of the current chain transmits the string of the current chain transmits the string encoding status of the current chainencoding status of the current chain

• P’P’aa repeats the previous message repeats the previous message

• PPjj acknowledges that it exists acknowledges that it exists

• P’P’jj repeats the previous message of repeats the previous message of PPjj

Page 40: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Messages Get ScrambledMessages Get Scrambled

• 1st or 2nd: P1st or 2nd: Paa does not receive its message back, does not receive its message back, PPjj, , P’P’jj are aware that either there was no agent or are aware that either there was no agent or at least one message was scrambled. at least one message was scrambled. PPjj starts a starts a new chain. new chain. PPaa terminates the current chainterminates the current chain

• 3rd: P3rd: Pjj does not receive its own message, does not receive its own message, PPjj and and P’P’jj are aware of the attack. are aware of the attack. PPjj and and P’P’jj “commit “commit suicide”suicide”

• 4th: P4th: Pjj behaves the same, behaves the same, P’P’jj will never hear its will never hear its partner, so will never respond with a messagepartner, so will never respond with a message

Page 41: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Merging ChainsMerging Chains

• We begin to group the Chains to longer We begin to group the Chains to longer chains, while spreading information about chains, while spreading information about active stationsactive stations

• Once a large enough Chain is collected, it Once a large enough Chain is collected, it prevents other chains from uniting by prevents other chains from uniting by "interfering" in reserved positions"interfering" in reserved positions

• The one large group elects a leaderThe one large group elects a leader

Page 42: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

The adversaryThe adversary

• Must guess the transmission slotsMust guess the transmission slots• IDs are hashed and rotatedIDs are hashed and rotated• Cannot stop all candidatesCannot stop all candidates• Must keep guessing correctly at second Must keep guessing correctly at second

stage to cause real damagestage to cause real damage• Almost impossible to prevent the success of Almost impossible to prevent the success of

the internal attackthe internal attack

Page 43: Efficient Algorithms for Leader Election in Radio Networks Tomasz Jurdziński Mirosław Kutyłowski Jan Zatopiański

Thank YouThank You

Ran AradRan Arad