已阅读5页,还剩64页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
.,1,AlgorithmsinGeneralAsynchronousNetworks,沈卓炜zwshen九龙湖校区计算机楼347房间Tel:52090919133909229522011年3月,.,2,Leaderelectioningeneralasynchronousnetworks,Undirectedgraphs.CangetasynchronousversionofsynchronousFloodMaxalgorithm:Simulateroundswithcounters.Needtoknowdiameterfortermination.FloodMaxalgorithm:Everyround:SendmaxUIDseentoallneighbors.Stopafterdiamrounds.ElectselfiffownUIDismaxseen.,.,3,Leaderelectioningeneralasynchronousnetworks,Wellseebetterasynchronousalgorithmslater:Dontneedtoknowdiameter.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:AllowonlydistanceestimatesD.Messages:O(D|E|);Time:O(diamD(l+d),.,37,AsynchBFS,Termination:Nooneknowswhenthisisdone,socantproduceparentoutputs.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:eachnodeatdistancekknowsitsparent,andeachnodeatdistancek-1alsoknowsitschildren.i0broadcastsnewphasemessagealongtreeedges,todistancekprocesses.Eachofthesesendssearchmessagetoallnbrsexceptitsparent.Whenanynon-i0processreceivesfirstsearchmessage,setsparent:=senderandsendsapositiveack;sendsnacksforsubsequentsearchmsgs.Whendistancekprocessreceivesacks/nacksforallitssearchmessages,designatesnodesthatsentpostiveacksasitschildren.Thendistancekprocessesconvergecastbacktoi0alongdepthktreetosaythattheyredone;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,Possibledistanceestimatesforikare2k1,2k2,0.Moreover,ikcantakeonalltheseestimatesinsequence:First,messagestraverseupperlinks,2k1.Thenlastlowermessagearrivesatik,2k2.Thenlowermessageik-2ik-1arrives,reducesik-1sestimateby2,messageik-1ikarrivesonupperlinks,2k3.Etc.Countdowninbinary.Ifthishappensquickly,getpileupof2ksearchmessagesinCk,k+1.,.,47,ShortestPaths,Moral:Unrestrainedasynchronycancauseproblems.Returntothisproblemafterwehavebettersynchronizationmethods.Now,anothergoodillustrationoftheproblemsintroducedbyasynchrony:,.,48,Minimumspanningtree,Assumptions:G=(V,E)connected,undirected.Weightededges,weightsknowntoendpointprocesses,weightsdistinct.UIDsProcessesdontknown,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,notretestingsameedgeonceitsrejected.Q:Howtorunthisalgorithmasynchronously?,.,52,RunningtheAlgasynchronously,Problemsarise:Inaccurateinformationaboutoutgoingedges:Insynchronousalgorithm,whenanodetestsitsedges,itknowsthatitsneighborsarealreadyuptothesamelevel,andhaveup-to-dateinformationabouttheircomponent.Inasynchronousversion,neighborscouldlagbehind;theymightbeinsamecomponentbutnotyetknowthis.Less“balanced”combinationofcomponents:Insynchronousalgorithm,levelkcomponentshave2knodes,andlevelk+1componentsareconstructedfromatleasttwolevelkcomponents.Inasynchronousversion,componentsatdifferentlevelscouldbecombined.Canleadtomoremessagesoverall.,.,53,RunningtheAlgasynchronously,Problemsarise:Inaccurateinformationaboutoutgoingedges:Less“balanced”combinationofcomponents:Concurrentoverlappingsearches/convergecasts:Whennodesareoutofsynch,concurrentsearchesforMWOEscouldinterferewitheachother(wellseethis).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.Numberofnodesinalevelkcomponent2k.Now,eachlevelk+1componentwillbe(initially)formedfromexactlytwolevelkcomponents.Levelnumbersareusedforsynchronization,andindeterminingwhoisinthesamecomponent.Complexity:Messages:O(|E|+nlogn)Time:O(nlogn(d+l),.,56,GHSalgorithm,Combinepairsofcomponentsintwoways,mergingandabsorbing.Merging:CandChavesamelevelk,andhaveacommonMWOE.ResultisanewmergedcomponentC,withlevelk+1.,.,57,GHSalgorithm,Absorbing:level(C)level(C),andCsMWOEleadstoC.ResultistoabsorbCintoC.Notcreatinganewcomponent,justaddingCtoexistingC.C“catchesup”withthemoreadvancedC.Absorbingischeap,local.Mergingandabsorbingensurethatthenumberofnodesinanylevelkcomponent2k.MergingandabsorbingarebothallowableoperationsinfindingMST,becausetheyareallowedbythegeneraltheoryforMSTs.,.,58,Liveness,Q:Whyaremergingandabsorbingsufficienttoensurethattheconstructioniseventuallycompleted?Lemma:Afteranyallowablefinitesequenceofmergesandabsorbs,eithertheforestconsistsofonetree(soweredone),orsomemergeorabsorbisenabled.,.,59,Liveness,Proof:Considerthecurrent“componentdigraph”:Nodes=componentsDirectededgescorrespondtoMWOEsThentheremustbesomepairC,CwhoseMWOEspointtoeachother.(Why?)TheseMWOEsmustbethesameedge.(Why?)Cancombine,usingeithermergeorabsorb:Ifsamelevel,merge,elseabsorb.So,mergingandabsorbingareenough.Now,howtoimplementthemwithadistributedalgorithm?,.,60,Componentnamesandleaders,Foreverycomponentwithlevel1,definethecoreedgeofthecomponentstree.Definedintermsofthemergeandabsorboperationsusedtoconstructthecomponent:Aftermerge:UsethecommonMWOE.Afterabsorb:Keeptheoldcoreedgeofthehigher-levelcomponent.“Theedgealongwhichthemostrecentmergeoccurred.”Componentname:(core,level)Leader:Endpointofcoreedgewithhigherid.,.,61,Determiningifanedgeisoutgoing,Supposeiwantstoknowiftheedge(i,j)isoutgoingfromiscurrentcomponent.Atthatpoint,iscomponentnameinfoisup-to-date:Componentisin“searchmode”.ihasreceivedinitiatemessagefromtheleader,whichcarriedcomponentname.Soisendsjatestmessage.Threecases:,.,62,Determiningifanedgeisoutgoing,Threecases:Ifjscurrent(core,level)isthesameasis,thenjknowsthatjisinthesamecomponentasi.Ifjs(core,level)isdifferentfromisandjslevelisis,thenjknowsthatjisinadifferentcomponentfromi.Componenthasonlyonecoreperlevel.Nooneinthesamecomponentcurrentlyhasahigherlevelthanidoes,sincethecomponentisstillsearchingforitsMWOE.Ifjslevelisis,thenjdoesntknowifitisinthesameoradifferentcomponent.Soitdoesntyetrespond-waitstocatchuptoislevel.,.,63,Liveness,again,Q:Cantheextradelaysimposedhereaffecttheprogressargument?No:Wecanredotheprogressargument,thistimeconsideringonlythosecomponentswiththelowestcurrentlevelk.AllprocessesinthesecomponentsmustsucceedindeterminingtheirMWOEs,sothesecomponentssucceedindeterminingthecomponentMWOE.IfanyoftheselevelkcomponentsMWOEsleadstoahigherlevel,canabsorb.Ifnotthenallleadtootherlevelkcomponents,soasbefore,wemusthavetwocomponentsthatpointtoeachother;socanmerge.,.,64,InterferenceamongconcurrentMWOEsearches,SupposeCgetsabsorbedintoCviaanedgefromitoj,whileCisworkingondeterminingitsMWOE.Twocases:jhasnotyetreporteditslocalmwoewhentheabsorboccurs.ThenitsnottoolatetoincludeCinthesearchfortheMWOEofC.SojforwardstheinitiatemessageintoC.jhasalreadyreporteditslocalmwoe.ThenitstoolatetoincludeCinthesearch.Butitdoesntmatter:theMWOEforthecombinedcomponentcantbeoutgoingfromanodeinCanyhow!,.,65,Afewdetails,Specificmessages:initiate:BroadcastfromleadertofindMWOE;piggybackscomponentname.report:ConvergecastMWOEresponsesbacktoleader.test:Askswhetheranedgeisoutgoingfromthecomponent.accept/reject:Answers.changeroot:SentfromleadertoendpointofMWOE.connect:SentacrosstheMWOE,toconnectcomponents.Wes
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 市政广场绿化设计与施工合同
- 洗浴中心招投标授权委托书模板
- 网约车驾驶员服务协议
- 南京市摄影基地租赁合同
- 环保旅游业PTR管理办法
- 城市绿化带扩建合同
- 文化艺术兼职演员合同
- 建筑材料市场租赁合同终止
- 图书馆围墙建设合同
- 人力资源成品油市场管理办法
- 农村留守儿童心理健康状况调查研究
- 手术室锐器刺伤
- 中国食物成分表2018年(标准版)第6版
- 消防安全教育主题班会:森林防火与消防安全 课件
- 【00后大学生理财意识与规划探究(定量论文)11000字】
- 公路消防知识培训内容
- 吊车吊装方案计算书
- 2024年云南省数字经济产业投资集团有限公司招聘笔试参考题库含答案解析
- 警方开展心理辅导活动方案
- 餐厅股份合作协议书
- 成人重症患者人工气道湿化护理专家共识
评论
0/150
提交评论