290 likes | 305 Views
Explore token circulation for ordered broadcast, virtual ring creation, visit order optimization, and performance metrics in mobile wireless systems. Understand the LF and LR algorithms for ensuring node visitation.
E N D
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch
Lecture 28 • Topic: • Token Circulation • Sources: • Malpani, Chen, Vaidya, & Welch • MIT 6.885 Fall 2008 slides Discrete Algs for Mobile Wireless Sys
Token Circulation • Circulate a token through all the nodes of a mobile ad hoc network • Application: ensure totally ordered broadcast in a group communication service Discrete Algs for Mobile Wireless Sys
Group Communication • Maintain information about group membership (which nodes are in which group) • Allowing nodes within a group to communicate • usually multicast • with some ordering properties, notably total order • Originally developed for wired networks Discrete Algs for Mobile Wireless Sys
Achieving Total Order • Circulate a token through all the nodes in the network along a virtual ring • token carries a sequence number • when token visits a node that wants to bcast a message, it increments the sequence number in the token and tags its message with that sequence number • Unique sequence numbers are used to sort out the proper ordering • Or: token carries the messages themselves • append new message to the end of the list • deliver messages in order they appear in the token Discrete Algs for Mobile Wireless Sys
Getting a Virtual Ring • How to find an efficient embedding of a ring in an arbitrary network, especially one that changes dynamically? • In fact, what does "efficient" mean? • What should be measured? Discrete Algs for Mobile Wireless Sys
Performance Measures • Distinguish between the token being routed to a node (message is received and forwarded w/o the node "using" the token) and the token visiting a node (node "uses" the token) • Round: minimal length execution fragment in which the token visits each node at least once • Performance measures: • round length: number of node visits in a round • message overhead: number of bytes sent per round • time overhead: time required to complete a round Discrete Algs for Mobile Wireless Sys
1 3 5 2 6 4 Bad Virtual Ring • Use visit order 1, 2, 3, 4, 5, 6, 1, 2, 3, … in the following physical network: • Msgs are routed as 1, 3, 5, 2, 5, 3, 1, 4, 6, 2, 5, 2, 6, … • Better order for virtual ring: 1, 3, 5, 2, 6, 4, 1, … Discrete Algs for Mobile Wireless Sys
Lesson • Take network topology into account when determining visit order • But global knowledge is expensive to achieve, and needs constant updating • Instead, have token make decision dynamically, based only on local information, as to where to travel next • Assume nodes know who their neighbors are (e.g., "hello" protocol) Discrete Algs for Mobile Wireless Sys
Algorithm Classification • Global ("G") vs. Local ("L"): • local: token is forwarded to a neighbor • global: token is forwarded to any node in the network • Recency ("R") vs. Frequency ("F"): • next recipient is decided based on how recently nodes have had the token • next recipient is decided based on how frequently nodes have had the token • For global algorithms, whether or not token visits nodes through which the token is routed on its way to current destination (denoted "N" if so) Discrete Algs for Mobile Wireless Sys
Algorithm Schema • Token carries some information for each node in the network (either recency or frequency info) • When a node receives the token, it chooses next recipient using the info in the token, updates info appropriately, and forwards token to appropriate neighbor Discrete Algs for Mobile Wireless Sys
Algorithm LF (Local-Frequency) • Claim: In a static connected graph, LF ensures that every node is visited infinitely often. • Proof: Suppose not. • Let S be the set of starved nodes (visited finitely often). • Then there exists a node x that is visited i.o. but has at least one neighbor in S. • Eventually, after all of x's neighbors in S have visited for the last time, the frequency count for some y in S will be the smallest among all of x's neighbors, and the token will be forwarded to y. Contradiction. Discrete Algs for Mobile Wireless Sys
1 3 5 2 4 Algorithm LF • Claim: Round length of LF is unbounded. • Length of even rounds: 6, 12, 20, 48, 96, … • Length of odd rounds: 6, 7, 19, 43, 91, … Discrete Algs for Mobile Wireless Sys
Algorithm LR • Claim: In a static connected graph, LR ensures that every node is visited i.o. • Proof is same as for LF. • What about round length? • In a static graph, one can traverse a spanning tree to get a round length of 2n • LR tries to improve by avoiding backtracking • Simulation results often achieves round length of n • But there exist graphs on which round length is exponential Discrete Algs for Mobile Wireless Sys
Algorithms GR and GF • Initially, when all nodes have been visited least recently/frequently, ties need to be broken somehow (say, by ID). • GR subsequently has no ties; for GF, break ties somehow (say, by ID) • Round length is obviously n. • remember, we are just counting number of node visits in the round length • message and time overhead take into account the relaying that may be necessary Discrete Algs for Mobile Wireless Sys
Algorithms GFN and GRN • For G*N, first determine node (in entire network) with smallest frequency/recency count • Then forward token to neighbor on route toward that node; token is to visit that neighbor • GFN performed very poorly in simulations • some node x is visited very often, racking up a large frequency count, causing subsequent rounds to be very long Discrete Algs for Mobile Wireless Sys
Bonus Algorithm • The best path for the token would be a Hamiltonian path of the network • path in the network that includes every node exactly once => round length n • not every graph has one • determining if a graph has one is NP-complete • Algorithm Iterative Search ("IS") uses heuristics to try to find an HP. • Simulation results: • worked well if nodes have exact neighbor knowledge • othewise not so good Discrete Algs for Mobile Wireless Sys
Simulations Performance measures: • Round length • Round time • Message overhead Random networks with 20 nodes • MAC layer: 802.11 • Routing: DSR • Network layer: TCP (to avoid token loss) Discrete Algs for Mobile Wireless Sys
Simulation: Static Network LF GRN LR, GF, GR
Simulation: Dynamic Network GR LF,LR,GF,GRN LR Round time Round length
Worst-Case Analysis of LR In simulation: average round length ~n Matching worst-case upper bound? Unfortunately, no • Exponential upper bound: O(nD), is max degree, D is diameter • Exponential lower bound: (n3(7/27)n+5) (confusing typo in paper) Discrete Algs for Mobile Wireless Sys
LR Worst-Case Upper-Bound Last node p p not visited We want to bound the number of nodes visited in a round p is visited only once. What about p’s neighbors? Discrete Algs for Mobile Wireless Sys
LR Worst-Case Upper-Bound p p not visited No neighbor q of p visited more than degree(q) times Lemma: • If node q is visited degree(q)+ 1 times in an execution segment, then all of q’s neighbors are visited in the segment. Discrete Algs for Mobile Wireless Sys
LR Worst-Case Upper-Bound Execution segment: … q q q q α1 x2 x1 x1 is more recent than any neighbor that was not visited in α1 Lemma: • If node q is visited degree(q)+ 1 times in an execution segment, then all of q’s neighbors are visited in the segment. Proof: Discrete Algs for Mobile Wireless Sys
LR Worst-Case Upper-Bound degree(q)+ 1 visits Execution segment: … q q q q α1 α2 x2 x1 x3 x1, x2 are more recent than any neighbor that was not visited in α1,α2 Lemma: • If node q is visited degree(q)+ 1 times in an execution segment, then all of q’s neighbors are visited in the segment. Proof: Discrete Algs for Mobile Wireless Sys
LR Worst-Case Upper-Bound No neighbor q of p visited more than degree(q) times Neighbors of neighbors of p? p p not visited Lemma: • If q is visited at most k times in an execution, then no neighbor q’ of q is visited more than (k+1) ·degree(q’) times in the execution. Discrete Algs for Mobile Wireless Sys
LR Worst-Case Upper-Bound ≤ k + 1 segments … Execution segment: q q q q q is not visited ⇒no neighbor q’ visited ≥degree(q’) times Part (a) Lemma: • If q is visited at most k times in an execution, then no neighbor q’ of q is visited more than (k+1) ·degree(q’) times in the execution. Proof: Discrete Algs for Mobile Wireless Sys
LR Worst-Case Upper-Bound Nodes # visits p1 N(p)≤ Δ N(N(p)) ≤ Δ(Δ + 1) = Δ2+ Δ … ND(p) ≤ ΔD+ΔD-1+…+Δ p p not visited No neighbor q of p visited more than degree(q) times Neighbors of neighbors of p? Lemma (b): if q is visited at most k times in an execution, then no neighbor q’ of q is visited more than (k+1) ·degree(q’) times in the execution. Δ= maximum degree, D = diameter of the graph N(A) = neighborhood of A Discrete Algs for Mobile Wireless Sys
LR Worst-Case Upper-Bound Nodes # visits p1 N(p)≤ Δ N(N(p)) ≤ Δ(Δ + 1) = Δ2+ Δ … ND(p) ≤ ΔD+ΔD-1+…+Δ Round length is bounded by 1 + |N(p)| · Δ + |N2(p)| · (Δ+ Δ 2) + + … + |ND(p)| · (ΔD+ΔD-1+…+Δ ) = = n · O( ΔD ) Lemma (b): if q is visited at most k times in an execution, then no neighbor q’ of q is visited more than (k+1) ·degree(q’) times in the execution. Δ= maximum degree, D = diameter of the graph N(A) = neighborhood of A Discrete Algs for Mobile Wireless Sys