版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、2021/7/241Algorithms in General Asynchronous Networks沈卓炜九龙湖校区计算机楼347房间 Tel:52090919133909229522011年3月2021/7/242Leader election in general asynchronous networks Undirected graphs. Can get asynchronous version of synchronous FloodMax algorithm: Simulate rounds with counters. Need to know diameter for
2、termination. FloodMax algorithm: Every round: Send max UID seen to all neighbors. Stop after diam rounds. Elect self iff own UID is max seen.2021/7/243Leader election in general asynchronous networks Well see better asynchronous algorithms later: Dont need to know diameter. Lower message complexity.
3、 Depend on techniques such as: Breadth-first search Convergecast using a spanning tree Synchronizers to simulate synchronous algorithms Consistent global snapshots to detect termination2021/7/244Spanning tree and searching Spanning trees are used for communication, e.g., broadcast/convergecast Start
4、 with the simple task of setting up some (arbitrary) spanning tree with a (given) root i0. Assume: Undirected, connected graph (i.e., bidirectional communication). Root i0 Size and diameter unknown. UIDs, with comparisons. Can identify in-and out-edges to same neighbor.2021/7/245Spanning tree and se
5、arching Require:Each process should output its parent in tree, with a parent output action. Starting point: SynchBFS algorithm: i0floods search message; parent of a node is the first node from which it receives a search message. Try running the same algorithm in asynchronous network. Still yields sp
6、anning tree, but not necessarily breadth-first tree.2021/7/246AsynchSpanning tree, Process i2021/7/247Asynchronous spanning tree2021/7/248Asynchronous spanning treeS2021/7/249Asynchronous spanning treeS2021/7/2410Asynchronous spanning treeS2021/7/2411Asynchronous spanning treeSS2021/7/2412Asynchrono
7、us spanning treeS2021/7/2413Asynchronous spanning treeSSS2021/7/2414Asynchronous spanning tree2021/7/2415AsynchSpanning tree Complexity Messages: O(|E|) Time: diam ( l + d ) + l Anomaly: Paths may be longer than diameter! Messages may travel faster along longer paths, in asynchronous networks.2021/7
8、/2416Application of AsynchSpanning tree Similar to synchronous BFS Message broadcast: Piggyback on search message. Child pointers: Add responses to search messages, easy because of bidirectional communication. Use precomputed tree for bcast/convergecast Now the timing anomaly arises O( h(l+d) ) time
9、 complexity. O(|E|) message complexity. h = height of tree; may be n2021/7/2417Applications of BFS Global computation: Sum, max, or any kind of data aggregation: Convergecast on BFS tree. Complexity: Time O(diameter); Messages O(n) Leader election (without knowing diameter): Everyone starts BFS, det
10、ermines max UID. Complexity: Time O(diam); Messages O(n|E|) (actually, O( diam|E|). Compute diameter: All do BFS. Convergecast to find height of each BFS tree. Convergecast again to find max of all heights.2021/7/2418More applications Asynchronous broadcast/convergecast: Can also construct spanning
11、tree while using it to broadcast message and also to collect responses. E.g., to tell the root when the bcast is done, or to collect aggregated data. Complexity: O(|E|) message complexity. O( n (l+d) ) time complexity, timing anomaly. Elect leader when nodes have no info about the network (no knowle
12、dge of n, diam, etc.; no root, no spanning tree)2021/7/2419Breadth-first spanning tree Assume (same as above): Undirected, connected graph (i.e., bidirectional communication). Root i0. Size and diameter unknown. UIDs, with comparisons. Require:Each process should output its parent in a breadth-first
13、 spanning tree.2021/7/2420Breadth-first spanning tree In asynchronous networks, modified SynchBFSdoes not guarantee that the spanning tree constructed is breadth-first. Long paths may be traversed faster than short ones. Can modify each process to keep track of distance, change parent when it hears
14、of shorter path. Relaxation algorithm (like Bellman-Ford). Must inform neighbors of changes. Eventually, tree stabilizes to a breadth-first spanning tree.2021/7/2421AsynchBFS2021/7/2422AsynchBFS02021/7/2423AsynchBFS002021/7/2424AsynchBFS0002021/7/2425AsynchBFS1002021/7/2426AsynchBFS10112021/7/2427As
15、ynchBFS10132112021/7/2428AsynchBFS104132112021/7/2429AsynchBFS10413211442021/7/2430AsynchBFS1021321442021/7/2431AsynchBFS10251321422021/7/2432AsynchBFS61023132112021/7/2433AsynchBFS61022132112021/7/2434AsynchBFS21022132102021/7/2435AsynchBFS1102213212021/7/2436AsynchBFS Complexity:Messages: O(n |E|)
16、 May send O(n) messages on each link (one for each distance estimate).Time: O(diam n (l+d) (taking pileups into account). Can reduce complexity if know bound D on diameter: Allow only distance estimates D. Messages: O(D |E|); Time: O(diamD (l+d) 2021/7/2437AsynchBFS Termination: No one knows when th
17、is is done, so cant produce parent outputs. Can augment with acks for search messages, convergecast back to i0. i0 learns when the tree has stabilized, tells everyone else. A bit tricky: Tree grows and shrinks. Some processes may participate many times, as they learn improvements. Bookkeeping needed
18、. Complexity?2021/7/2438Layered BFS Asynchrony leads to many corrections, which lead to lots of communication. Idea: Slow down communication, grow the tree in synchronized phases. In phase k, incorporate all nodes at distance k from i0. i0 synchronizes between incorporating nodes at distance k and k
19、+1. Phase 1: i0 sends search messages to neighbors. Neighbors set dist:= 1, send acks to i0. 2021/7/2439Layered BFS Phase k+1: Assume phases 1,k are completed: each node at distance k knows its parent, and each node at distance k-1 also knows its children. i0 broadcasts newphase message along tree e
20、dges, to distance k processes. Each of these sends search message to all nbrs except its parent. When any non-i0 process receives first search message, sets parent:= sender and sends a positive ack; sends nacks for subsequent search msgs. When distance k process receives acks/nacks for all its searc
21、h messages, designates nodes that sent postive acks as its children. Then distance k processes convergecast back to i0 along depth k tree to say that theyre done; include a bit saying whether new nodes were found.2021/7/2440Layered BFS Terminates: When i0 learns, in some phase, that no new nodes wer
22、e found. Obviously produces BFS tree. Complexity: Messages: O(|E| + n diam) Time: Use simplified analysis: Neglecting local computation time l Assuming that every message in a channel is delivered in time d(ignoring congestion delays). O(diam2 d)Each edge explored at most once in each direction by s
23、earch/ack. Each tree edge traversed at most once in each phase by newphase/convergecast.2021/7/2441Layered BFS vs AsynchBFS Message complexity: AsynchBFS: O(diam|E|), assuming diam is known, O(n|E|) if not LayeredBFS: O(|E| + n diam) Time complexity: AsynchBFS: O(diamd) LayeredBFS: O(diam2d) Can als
24、o define “hybrid”algorithm Add m layers in each phase. Within each phase, layers constructed asynchronously. Intermediate performance.2021/7/2442Shortest Paths Assumptions: Same as for BFS, plus edge weights. weight(i,j),nonnegative real, same in both directions. Require: Output shortest distance an
25、d parent in shortest-paths tree. Use Bellman-Ford asynchronously Used to establish routes in ARPANET 1969-1980. Can augment with convergecast as for BFS, for termination. But worst-case complexity is very bad2021/7/2443AsynchBellmanFord2021/7/2444AsynchBellmanFord Termination: Use convergecast (as f
26、or AsynchBFS). Complexity: O(n!) simple paths from i0 to any other node, which is O(nn). So the number of messages sent on any channel is O(nn). So message complexity = O(nn|E|), time complexity = O(nnn (l+d).2021/7/2445AsynchBellmanFord Complexity: Q:Are the message and time complexity really expon
27、ential in n? A:Yes: In some execution of network below, iksends 2kmessages to ik+1, so message complexity is (2n/2) and time complexity is (2n/2d).2021/7/2446Exponential time/message complexity Possible distance estimates for ik are 2k1, 2k2,0. Moreover, ik can take on all these estimates in sequenc
28、e: First, messages traverse upper links, 2k1. Then last lower message arrives at ik, 2k2. Then lower message ik-2 ik-1 arrives, reduces ik-1s estimate by 2, message ik-1 ik arrives on upper links, 2k3. Etc. Count down in binary. If this happens quickly, get pileup of 2k search messages in Ck,k+1.202
29、1/7/2447Shortest Paths Moral: Unrestrained asynchrony can cause problems. Return to this problem after we have better synchronization methods. Now, another good illustration of the problems introduced by asynchrony:2021/7/2448Minimum spanning tree Assumptions: G = (V,E) connected, undirected. Weight
30、ed edges, weights known to endpoint processes, weights distinct. UIDs Processes dont know n, diam. Can identify in-and out-edges to same neighbor. Input: wakeup actions, occurring at any time at one or more nodes. Process wakes up when it first receives either a wakeupinput or a protocol message.202
31、1/7/2449Minimum spanning tree Assumptions: Requires: Produce MST, where each process knows which of its incident edges belong to the tree. Guaranteed to be unique, because of unique weights. Gallager-Humblet-Spira algorithm 2021/7/2450Recall synchronous algorithm Proceeds in phases (levels). After e
32、ach phase, we have a spanning forest, in which each component tree has a leader. In each phase, each component finds min weight outgoing edge (MWOE),then components merge using all MWOEs to get components for next phase.2021/7/2451Synchronous algorithm Complexity is good: Messages: O(nlog n + |E|) T
33、ime (rounds): O(nlog n) Low message complexity depends on the way nodes test their incident edges, in order of weight, not retesting same edge once its rejected. Q:How to run this algorithm asynchronously?2021/7/2452Running the Alg asynchronously Problems arise: Inaccurate information about outgoing
34、 edges: In synchronous algorithm, when a node tests its edges, it knows that its neighbors are already up to the same level, and have up-to-date information about their component. In asynchronous version, neighbors could lag behind; they might be in same component but not yet know this. Less “balanc
35、ed”combination of components: In synchronous algorithm, level k components have 2knodes, and level k+1 components are constructed from at least two level k components. In asynchronous version, components at different levels could becombined. Can lead to more messages overall. 2021/7/2453Running the
36、Alg asynchronously Problems arise: Inaccurate information about outgoing edges: Less “balanced”combination of components: Concurrent overlapping searches/convergecasts: When nodes are out of synch, concurrent searches for MWOEs could interfere with each other (well see this). Time bound: These probl
37、ems result from nodes being out-of-synch, at different levels. We could try to synchronize levels, but this must be done carefully, so as not to hurt the time complexity too much.2021/7/2454GHS algorithm Same basic ideas as before: Form components, combine along MWOEs. Within any component, processe
38、s cooperate to find component MWOE. Broadcast from leader, convergecast, etc.2021/7/2455GHS algorithm Introduce synchronization to prevent nodes from getting too far ahead of their neighbors. Associate a “level”with each component, as before. Number of nodes in a level k component 2k. Now, each leve
39、l k+1 component will be (initially) formed from exactly two level k components. Level numbers are used for synchronization, and in determining who is in the same component. Complexity: Messages:O(|E| + n log n) Time:O(nlog n (d + l) 2021/7/2456GHS algorithm Combine pairs of components in two ways, m
40、erging and absorbing. Merging: C and C have same level k, and have a common MWOE. Result is a new merged component C, with level k+1.2021/7/2457GHS algorithm Absorbing: level(C) level(C), and Cs MWOE leads to C. Result is to absorb C into C. Not creating a new component , just adding C to existing C
41、. C “catches up” with the more advanced C. Absorbing is cheap, local. Merging and absorbing ensure that the number of nodes in any level k component 2k. Merging and absorbing are both allowable operations in finding MST, because they are allowed by the general theory for MSTs.2021/7/2458Liveness Q:W
42、hy are merging and absorbing sufficient to ensure that the construction is eventually completed? Lemma: After any allowable finite sequence of merges and absorbs, either the forest consists of one tree (so were done), or some merge or absorb is enabled.2021/7/2459Liveness Proof: Consider the current
43、 “component digraph”: Nodes = components Directed edges correspond to MWOEs Then there must be some pair C, C whose MWOEs point to each other. (Why?) These MWOEs must be the same edge. (Why?) Can combine, using either merge or absorb: If same level, merge, else absorb. So, merging and absorbing are
44、enough. Now, how to implement them with a distributed algorithm?2021/7/2460Component names and leaders For every component with level 1, define the core edge of the components tree. Defined in terms of the merge and absorb operations used to construct the component: After merge: Use the common MWOE.
45、 After absorb: Keep the old core edge of the higher-level component. “The edge along which the most recent merge occurred.” Component name: (core, level) Leader: Endpoint of core edge with higher id.2021/7/2461Determining if an edge is outgoing Suppose i wants to know if the edge (i, j) is outgoing
46、from is current component. At that point, is component name info is up-to-date: Component is in “search mode”. i has received initiate message from the leader, which carried component name. So i sends j a test message. Three cases:2021/7/2462Determining if an edge is outgoing Three cases: If js curr
47、ent (core, level) is the same as is, then j knows that j is in the same component as i. If js(core, level) is different from is and js level is is, then j knows that j is in a different component from i. Component has only one core per level. No one in the same component currently has a higher level
48、 than i does, since the component is still searching for its MWOE. If js level is is, then j doesnt know if it is in the same or a different component. So it doesnt yet respond-waits to catch up to is level.2021/7/2463Liveness, again Q: Can the extra delays imposed here affect the progress argument?
49、 No: We can redo the progress argument, this time considering only those components with the lowest current level k. All processes in these components must succeed in determining their MWOEs, so these components succeed in determining the component MWOE. If any of these level k components MWOEs lead
50、s to a higher level, can absorb. If not then all lead to other level k components, so as before, we must have two components that point to each other; so can merge.2021/7/2464Interference among concurrent MWOE searches Suppose C gets absorbed into C via an edge from i to j, while C is working on det
51、ermining its MWOE. Two cases: j has not yet reported its local mwoe when the absorb occurs. Then its not too late to include C in the search for the MWOE of C. So j forwards the initiate message into C. j has already reported its local mwoe. Then its too late to include C in the search. But it doesn
52、t matter: the MWOE for the combined component cant be outgoing from a node in C anyhow!2021/7/2465A few details Specific messages: initiate:Broadcast from leader to find MWOE; piggybacks component name. report: Convergecast MWOE responses back to leader. test:Asks whether an edge is outgoing from the component. accept/reject:Answers. changeroot: Sent from leader to endpoint of MWOE. connect: Sent across the MWOE, to connect components. We say merge occurs when co
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 拔钉枪项目可行性研究报告
- 年产xxx树脂基复合材料项目建议书
- 2023年计算器及货币专用设备资金申请报告
- 三年级上册数学导学案-6.6 买矿泉水|北师大版
- 2022-2023学年广东省深圳市龙华区五年级(上)期末英语试卷
- 建筑电气安装培训
- 2.7 植被与自然环境的关系 课件 2高一上学期 课件 中图版(2019)必修一
- 脚手架应急预案
- 急救知识试题
- 旅游大会文明志愿者培训
- 超星尔雅学习通《军事理论(上海财经大学版)》章节测试答案
- 医学心理学(广东药科大学)智慧树知到答案章节测试2023年
- 河道整治工程毕业设计
- 第三部分34课财报阅读方法与技巧之识别老千股
- SB/T 10482-2008预制肉类食品质量安全要求
- GB/T 40427-2021电力系统电压和无功电力技术导则
- GB/T 13912-2020金属覆盖层钢铁制件热浸镀锌层技术要求及试验方法
- 2023年全国中学生英语能力竞赛(NEPCS)初赛初二组试题笔试部分完整版
- FZ/T 93015-2010转杯纺纱机
- 幼儿园突发事件应急处置流程图
- 国开《可编程控制器应用》形考任务五实验1
评论
0/150
提交评论