bully.pdf
Post on 02-Jun-2018
213 Views
Preview:
TRANSCRIPT
-
8/10/2019 bully.pdf
1/6
2/20/20
ElectionAlgorithms
Manydistributedalgorithmsneedoneprocesstoactasaleaderorcoordinator
Doesntmatterwhichprocessdoesthejob,justneedtopickone
Example:pickamasterinBerkeleyclocksynchronizationalgorithm
Electionalgorithms:techniquetopickauniquecoordinator
Assumption:each
process
has
aunique
ID
Goal:findthenoncrashedprocesswiththehighestID
1
BullyAlgorithm
Assumptions
EachprocessknowstheIDandaddressofeveryotherprocess
Communicationisreliable
Aprocessinitiatesanelectionifitjustrecoveredfromfailureoritnoticesthatthecoordinatorhasfailed
Threetypesofmessages:Election,OK,Coordinator
Several
processes
can
initiate
an
election
simultaneously
Needconsistentresult
2
-
8/10/2019 bully.pdf
2/6
2/20/20
BullyAlgorithmDetails
AnyprocessPcaninitiateanelection
PsendsElectionmessagestoallprocesswithhigherIDsandawaitsOKmessages IfnoOKmessages,Pbecomescoordinatorandsends
CoordinatormessagestoallprocesseswithlowerIDs
IfitreceivesanOK,itdropsoutandwaitsforanCoordinatormessage
IfaprocessreceivesanElectionmessage ImmediatelysendsCoordinatormessageifitistheprocesswith
highestID
Otherwise,returnsanOKandstartsanelection
Ifaprocess
receives
aCoordinatormessage,
it
treats
senderasthecoordinator
3
Bully
Algorithm
Example
4
-
8/10/2019 bully.pdf
3/6
2/20/20
RingAlgorithm
Processesarearrangedinalogicalring,eachprocessknowsthestructureofthering
Aprocessinitiatesanelectionifitjustrecoveredfromfailure
oritnoticesthatthecoordinatorhasfailed
InitiatorsendsElectionmessagetoclosestdownstreamnode
thatisalive
Electionmessageisforwardedaroundthering
EachprocessaddsitsownIDtotheElectionmessage
WhenElectionmessagecomesback,initiatorpicksnodewith
highestIDandsendsaCoordinatormessagespecifyingthe
winneroftheelection
Coordinatormessageisremovedwhenithascirculatedonce.
Multipleelectionscanbeinprogress5
RingAlgorithm
Example
6
-
8/10/2019 bully.pdf
4/6
2/20/20
ComparisonofBullyandRing
Algorithms
Assumenprocessesandoneelectioninprogress
Bullyalgorithm
Worstcase:initiatorisnodewithlowestID
Triggersn2electionsathigherrankednodes:O(n2)
messages
Bestcase:initiatorisnodewithhighestID
Immediateelection:n1messages
Ringalgorithm
2nmessagesalways
7
Electionin
Wireless
Environments
Goal:electthebestleader(e.g.,nodewith
longestbatterylifetime)
8
Nodeainitiatesanelection.
-
8/10/2019 bully.pdf
5/6
2/20/20
ElectioninWirelessNetworks
9Intheend,sourceanotesthathisthebestleaderandbroadcaststhisinfotoallnodes.
Superpeer Election
Howcanweselectsuperpeers suchthat
Normalnodeshavelowlatencyaccessto
superpeers
Superpeers areevenlydistributedacrossthe
overlaynetwork
Thereisapredefinedfractionofsuperpeers
Eachsuperpeer should
not
need
to
serve
more
thanafixednumberofnormalnodes
10
-
8/10/2019 bully.pdf
6/6
2/20/20
Superpeer ElectioninDHTBased
Systems
Basicidea:ReserveafractionoftheIDspaceforsuperpeers
IfSsuperpeers areneededforasystemthatusesmbitidentifiers,simplyreservethe
leftmostbitsforsuperpeers
WithNnodes,wewillhaveN/2mk superpeers onaverage
Routingtosuperpeer:Letm=8andk=3,sendlookuprequestforkeypto
noderesponsible
for
pAND
11100000
which
is
treatedasthesuperpeer
Sk 2log
11
top related