分布式算法5ppt课件_第1页
分布式算法5ppt课件_第2页
分布式算法5ppt课件_第3页
分布式算法5ppt课件_第4页
分布式算法5ppt课件_第5页
已阅读5页,还剩64页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1 AlgorithmsinGeneralAsynchronousNetworks 沈卓炜zwshen 九龙湖校区计算机楼347房间Tel 52090919133909229522011年3月 2 Leaderelectioningeneralasynchronousnetworks Undirectedgraphs CangetasynchronousversionofsynchronousFloodMaxalgorithm Simulateroundswithcounters Needtoknowdiameterfortermination FloodMaxalgorithm Everyround SendmaxUIDseentoallneighbors Stopafterdiamrounds ElectselfiffownUIDismaxseen 3 Leaderelectioningeneralasynchronousnetworks We llseebetterasynchronousalgorithmslater Don tneedtoknowdiameter Lowermessagecomplexity Dependontechniquessuchas Breadth firstsearchConvergecastusingaspanningtreeSynchronizerstosimulatesynchronousalgorithmsConsistentglobalsnapshotstodetecttermination 4 Spanningtreeandsearching Spanningtreesareusedforcommunication e g broadcast convergecastStartwiththesimpletaskofsettingupsome arbitrary spanningtreewitha given rooti0 Assume Undirected connectedgraph i e bidirectionalcommunication Rooti0Sizeanddiameterunknown UIDs withcomparisons Canidentifyin andout edgestosameneighbor 5 Spanningtreeandsearching Require Eachprocessshouldoutputitsparentintree withaparentoutputaction Startingpoint SynchBFSalgorithm i0floodssearchmessage parentofanodeisthefirstnodefromwhichitreceivesasearchmessage Tryrunningthesamealgorithminasynchronousnetwork Stillyieldsspanningtree butnotnecessarilybreadth firsttree 6 AsynchSpanningtree Processi 7 Asynchronousspanningtree 8 Asynchronousspanningtree S 9 Asynchronousspanningtree S 10 Asynchronousspanningtree S 11 Asynchronousspanningtree S S 12 Asynchronousspanningtree S 13 Asynchronousspanningtree S S S 14 Asynchronousspanningtree 15 AsynchSpanningtree ComplexityMessages O E Time diam l d lAnomaly Pathsmaybelongerthandiameter Messagesmaytravelfasteralonglongerpaths inasynchronousnetworks 16 ApplicationofAsynchSpanningtree SimilartosynchronousBFSMessagebroadcast Piggybackonsearchmessage Childpointers Addresponsestosearchmessages easybecauseofbidirectionalcommunication Useprecomputedtreeforbcast convergecastNowthetiminganomalyarisesO h l d timecomplexity O E messagecomplexity h heightoftree mayben 17 ApplicationsofBFS Globalcomputation Sum max oranykindofdataaggregation ConvergecastonBFStree Complexity TimeO diameter MessagesO n Leaderelection withoutknowingdiameter EveryonestartsBFS determinesmaxUID Complexity TimeO diam MessagesO n E actually O diam E Computediameter AlldoBFS ConvergecasttofindheightofeachBFStree Convergecastagaintofindmaxofallheights 18 Moreapplications Asynchronousbroadcast convergecast Canalsoconstructspanningtreewhileusingittobroadcastmessageandalsotocollectresponses E g totelltherootwhenthebcastisdone ortocollectaggregateddata Complexity O E messagecomplexity O n l d timecomplexity timinganomaly Electleaderwhennodeshavenoinfoaboutthenetwork noknowledgeofn diam etc noroot nospanningtree 19 Breadth firstspanningtree Assume sameasabove Undirected connectedgraph i e bidirectionalcommunication Rooti0 Sizeanddiameterunknown UIDs withcomparisons Require Eachprocessshouldoutputitsparentinabreadth firstspanningtree 20 Breadth firstspanningtree Inasynchronousnetworks modifiedSynchBFSdoesnotguaranteethatthespanningtreeconstructedisbreadth first Longpathsmaybetraversedfasterthanshortones Canmodifyeachprocesstokeeptrackofdistance changeparentwhenithearsofshorterpath Relaxationalgorithm likeBellman Ford Mustinformneighborsofchanges Eventually treestabilizestoabreadth firstspanningtree 21 AsynchBFS 22 AsynchBFS 0 23 AsynchBFS 0 0 24 AsynchBFS 0 0 0 25 AsynchBFS 1 0 0 26 AsynchBFS 1 0 1 1 27 AsynchBFS 1 0 1 3 2 1 1 28 AsynchBFS 1 0 4 1 3 2 1 1 29 AsynchBFS 1 0 4 1 3 2 1 1 4 4 30 AsynchBFS 1 0 2 1 3 2 1 4 4 31 AsynchBFS 1 0 2 5 1 3 2 1 4 2 32 AsynchBFS 6 1 0 2 3 1 3 2 1 1 33 AsynchBFS 6 1 0 2 2 1 3 2 1 1 34 AsynchBFS 2 1 0 2 2 1 3 2 1 0 35 AsynchBFS 1 1 0 2 2 1 3 2 1 36 AsynchBFS Complexity Messages O n E MaysendO n messagesoneachlink oneforeachdistanceestimate Time O diamn l d takingpileupsintoaccount CanreducecomplexityifknowboundDondiameter Allowonlydistanceestimates D Messages O D E Time O diamD l d 37 AsynchBFS Termination Nooneknowswhenthisisdone socan tproduceparentoutputs Canaugmentwithacksforsearchmessages convergecastbacktoi0 i0learnswhenthetreehasstabilized tellseveryoneelse Abittricky Treegrowsandshrinks Someprocessesmayparticipatemanytimes astheylearnimprovements Bookkeepingneeded Complexity 38 LayeredBFS Asynchronyleadstomanycorrections whichleadtolotsofcommunication Idea Slowdowncommunication growthetreeinsynchronizedphases Inphasek incorporateallnodesatdistancekfromi0 i0synchronizesbetweenincorporatingnodesatdistancekandk 1 Phase1 i0sendssearchmessagestoneighbors Neighborssetdist 1 sendackstoi0 39 LayeredBFS Phasek 1 Assumephases1 karecompleted eachnodeatdistance kknowsitsparent andeachnodeatdistance k 1alsoknowsitschildren i0broadcastsnewphasemessagealongtreeedges todistancekprocesses Eachofthesesendssearchmessagetoallnbrsexceptitsparent Whenanynon i0processreceivesfirstsearchmessage setsparent senderandsendsapositiveack sendsnacksforsubsequentsearchmsgs Whendistancekprocessreceivesacks nacksforallitssearchmessages designatesnodesthatsentpostiveacksasitschildren Thendistancekprocessesconvergecastbacktoi0alongdepthktreetosaythatthey redone includeabitsayingwhethernewnodeswerefound 40 LayeredBFS Terminates Wheni0learns insomephase thatnonewnodeswerefound ObviouslyproducesBFStree Complexity Messages O E ndiam Time Usesimplifiedanalysis NeglectinglocalcomputationtimelAssumingthateverymessageinachannelisdeliveredintimed ignoringcongestiondelays O diam2d Eachedgeexploredatmostonceineachdirectionbysearch ack Eachtreeedgetraversedatmostonceineachphasebynewphase convergecast 41 LayeredBFSvsAsynchBFS Messagecomplexity AsynchBFS O diam E assumingdiamisknown O n E ifnotLayeredBFS O E ndiam Timecomplexity AsynchBFS O diamd LayeredBFS O diam2d Canalsodefine hybrid algorithmAddmlayersineachphase Withineachphase layersconstructedasynchronously Intermediateperformance 42 ShortestPaths Assumptions SameasforBFS plusedgeweights weight i j nonnegativereal sameinbothdirections Require Outputshortestdistanceandparentinshortest pathstree UseBellman FordasynchronouslyUsedtoestablishroutesinARPANET1969 1980 CanaugmentwithconvergecastasforBFS fortermination Butworst casecomplexityisverybad 43 AsynchBellmanFord 44 AsynchBellmanFord Termination Useconvergecast asforAsynchBFS Complexity O n simplepathsfromi0toanyothernode whichisO nn SothenumberofmessagessentonanychannelisO nn Somessagecomplexity O nn E timecomplexity O nnn l d 45 AsynchBellmanFord Complexity Q Arethemessageandtimecomplexityreallyexponentialinn A Yes Insomeexecutionofnetworkbelow iksends2kmessagestoik 1 somessagecomplexityis 2n 2 andtimecomplexityis 2n 2d 46 Exponentialtime messagecomplexity Possibledistanceestimatesforikare2k 1 2k 2 0 Moreover ikcantakeonalltheseestimatesinsequence First messagestraverseupperlinks 2k 1 Thenlastlowermessagearrivesatik 2k 2 Thenlowermessageik 2 ik 1arrives reducesik 1 sestimateby2 messageik 1 ikarrivesonupperlinks 2k 3 Etc Countdowninbinary Ifthishappensquickly getpileupof2ksearchmessagesinCk k 1 47 ShortestPaths Moral Unrestrainedasynchronycancauseproblems Returntothisproblemafterwehavebettersynchronizationmethods Now anothergoodillustrationoftheproblemsintroducedbyasynchrony 48 Minimumspanningtree Assumptions G V E connected undirected Weightededges weightsknowntoendpointprocesses weightsdistinct UIDsProcessesdon tknown diam Canidentifyin andout edgestosameneighbor Input wakeupactions occurringatanytimeatoneormorenodes Processwakesupwhenitfirstreceiveseitherawakeupinputoraprotocolmessage 49 Minimumspanningtree Assumptions Requires ProduceMST whereeachprocessknowswhichofitsincidentedgesbelongtothetree Guaranteedtobeunique becauseofuniqueweights Gallager Humblet Spiraalgorithm 50 Recallsynchronousalgorithm Proceedsinphases levels Aftereachphase wehaveaspanningforest inwhicheachcomponenttreehasaleader Ineachphase eachcomponentfindsminweightoutgoingedge MWOE thencomponentsmergeusingallMWOEstogetcomponentsfornextphase 51 Synchronousalgorithm Complexityisgood Messages O nlogn E Time rounds O nlogn Lowmessagecomplexitydependsonthewaynodestesttheirincidentedges inorderofweight notretestingsameedgeonceit srejected Q Howtorunthisalgorithmasynchronously 52 RunningtheAlgasynchronously Problemsarise Inaccurateinformationaboutoutgoingedges Insynchronousalgorithm whenanodetestsitsedges itknowsthatitsneighborsarealreadyuptothesamelevel andhaveup to dateinformationabouttheircomponent Inasynchronousversion neighborscouldlagbehind theymightbeinsamecomponentbutnotyetknowthis Less balanced combinationofcomponents Insynchronousalgorithm levelkcomponentshave 2knodes andlevelk 1componentsareconstructedfromatleasttwolevelkcomponents Inasynchronousversion componentsatdifferentlevelscouldbecombined Canleadtomoremessagesoverall 53 RunningtheAlgasynchronously Problemsarise Inaccurateinformationaboutoutgoingedges Less balanced combinationofcomponents Concurrentoverlappingsearches convergecasts Whennodesareoutofsynch concurrentsearchesforMWOEscouldinterferewitheachother we llseethis Timebound Theseproblemsresultfromnodesbeingout of synch atdifferentlevels Wecouldtrytosynchronizelevels butthismustbedonecarefully soasnottohurtthetimecomplexitytoomuch 54 GHSalgorithm Samebasicideasasbefore Formcomponents combinealongMWOEs Withinanycomponent processescooperatetofindcomponentMWOE Broadcastfromleader convergecast etc 55 GHSalgorithm Introducesynchronizationtopreventnodesfromgettingtoofaraheadoftheirneighbors Associatea level witheachcomponent asbefore Numberofnodesinalevelkcomponent 2k Now eachlevelk 1componentwillbe initially formedfromexactlytwolevelkcomponents Levelnumbersareusedforsynchronization andindeterminingwhoisinthesamecomponent Complexity Messages O E nlogn Time O nlogn d l 56 GHSalgorithm Combinepairsofcomponentsintwoways mergingandabsorbing Merging CandC havesamelevelk andhaveacommonMWOE ResultisanewmergedcomponentC withlevelk 1 57 GHSalgorithm Absorbing level C level C andC sMWOEleadstoC ResultistoabsorbCintoC Notcreatinganewcomponent justaddingCtoexistingC C catchesup withthemoreadvancedC Absorbingischeap local Mergingandabsorbingensurethatthenumberofnodesinanylevelkcomponent 2k MergingandabsorbingarebothallowableoperationsinfindingMST becausetheyareallowedbythegeneraltheoryforMSTs 58 Liveness Q Whyaremergingandabsorbingsufficienttoensurethattheconstructioniseventuallycompleted Lemma Afteranyallowablefinitesequenceofmergesandabsorbs eithertheforestconsistsofonetree sowe redone orsomemergeorabsorbisenabled 59 Liveness Proof Considerthecurrent componentdigraph Nodes componentsDirectededgescorrespondtoMWOEsThentheremustbesomepairC C whoseMWOEspointtoeachother Why TheseMWOEsmustbethesameedge Why Cancombine usingeithermergeorabsorb Ifsamelevel merge elseabsorb So mergingandabsorbingareenough Now howtoimplementthemwithadistributedalgorithm 60 Componentnamesandleaders Foreverycomponentwithlevel 1 definethecoreedgeofthecomponent stree Definedintermsofthemergeandabsorboperationsusedtoconstructthecomponent Aftermerge UsethecommonMWOE Afterabsorb Keeptheoldcoreedgeofthehigher levelcomponent Theedgealongwhichthemostrecentmergeoccurred Componentname core level Leader Endpointofcoreedgewithhigherid 61 Determiningifanedgeisoutgoing Supposeiwantstoknowiftheedge i j isoutgoingfromi scurrentcomponent Atthatpoint i scomponentnameinfoisup to date Componentisin searchmode ihasreceivedinitiatemessagefromtheleader whichcarriedcomponentname Soisendsjatestmessage Threecases 62 Determiningifanedgeisoutgoing Threecases Ifj scurrent core level isthesameasi s thenjknowsthatjisinthesamecomponentasi Ifj s core level isdifferentfromi sandj slevelis i s thenjknowsthatjisinadifferentcomponentfromi Componenthasonlyonecoreperlevel Nooneinthesamecomponentcurrentlyhasahigherlevelthanidoes sincethecomponentisstillsearchingforitsMWOE Ifj slevelis i s thenjdoesn tknowifitisinthesameoradifferentcomponent Soitdoesn tyetrespond waitstocatchuptoi slevel 63 Liveness again Q Cantheextradelaysimposedhereaffecttheprogressargument No Wecanredotheprogressargument thistimeconsideringonlythosecomponentswiththelowestcurrentlevelk AllprocessesinthesecomponentsmustsucceedindeterminingtheirMWOEs sothesecomponentssucceedindeterminingthecomponentMWOE Ifanyoftheselevelkcomponents MWOEsleadstoahigherlevel canabsorb Ifnotthenallleadtootherlevelkcomponents soasbefore wemusthavetwocomponentsthatpointtoeachother socanmerge 64 InterferenceamongconcurrentMWOEsearches SupposeCgetsabsorbedintoC viaanedgefromitoj whileC isworkingondeterminingitsMWOE Twocases jhasnotyetreporteditslocalmwoewhentheabsorboccurs Thenit snottoolatetoincludeCinthesearchfortheMWOEofC SojforwardstheinitiatemessageintoC jhasalreadyreporteditslocalmwoe Thenit stoolatetoincludeCinthesearch Butitdoesn tmatter theMWOEforthecombinedcomponentcan tbeoutgoingfromanodeinCanyhow 65 Afewdetails Specificmessages initiate BroadcastfromleadertofindMWOE piggybackscomponentname report ConvergecastMWOEresponsesbacktoleader test Askswhetheranedgeisoutgoingfromthecomponent accept reject Answers changeroot SentfromleadertoendpointofMWOE connect SentacrosstheMWOE toconnectcompon

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论