Download presentation
Presentation is loading. Please wait.
1
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch
2
Discrete Algs for Mobile Wireless Sys2 Lecture 28 Topic: Distributed Primitives Using Link Reversal Sources: Walter, Welch & Vaidya Malpani, Welch & Vaidya Ingram, Shields, Walter & Welch MIT 6.885 Fall 2008 slides
3
Discrete Algs for Mobile Wireless Sys3 Mutual Exclusion in MANETs [WWV] Problem statement: Assume a single connected component No two nodes are ever in the critical section (CS) simultaneously If topology changes eventually cease, then every request to enter the CS is eventually granted.
4
Discrete Algs for Mobile Wireless Sys4 Mutual Exclusion Raymond's (1989) ME algorithm: unique token that traverses the network over a spanning tree node with token can enter CS nodes that want to enter CS send requests toward the token holder What happens if links disappear? Give a logical direction to all the links, not just those in a spanning tree, to get more redundancy Use link reversal ideas with a twist: token-holder is destination (of request messages), but different nodes are token-holder at different times
5
Discrete Algs for Mobile Wireless Sys5 ME Algorithm [WWV] Heights are triples (partial reversal, as in [GB]) Each node keeps a queue of ids of neighbors that have sent it requests Each node identifies one of its outgoing links as its next link. node 1 requests node 3 requests node 2 requests node 0 leaves the CS, forwards the token to 3, and sends a req. to 3 on behalf of 2. When 3 gets the token, it lowers its height… 30 12 1 13 3 2 2
6
Discrete Algs for Mobile Wireless Sys6 ME Algorithm with No Link Failures 3 0 1 2 1 13 2 2 0 node 3 forwards token to 1, follows it with a request node 1 enters CS since it is at head of queue; when done, forwards token to 3 3 0 1 2 1 30 2 2 3 30 3 0 1 2 2 2 node 3 enters CS since it is at head of queue; when done, forwards token to 0 3 0 1 2 2 2 node 0 forwards token to 2, etc.
7
Discrete Algs for Mobile Wireless Sys7 ME Algorithm with Failures 0 removes 3 from queue; 3 raises ht., purges queue, sends req. on new next to 1 1 raises ht., sends req. on new next to 2 3 0 1 2 1 3 2 2 3 3 0 1 2 1 3 2 2 3 1 3 3 0 1 2 2 2 13 1 A node that loses its last outgoing link either due to link failure or due to nbr’s height change does a partial reversal to raise its height. Queues must be adjusted.
8
Discrete Algs for Mobile Wireless Sys8 Correctness of ME Algorithm Safety: There is never more than one node in the CS at a time. The unique token ensures this. Liveness: Eventually every request to enter the CS is granted. To prove this, we use a "variant function" argument…
9
Discrete Algs for Mobile Wireless Sys9 Request Chain and Variant Function 30 12 1 13 3 2 2 In this state, node 1’s request chain is: node 1, node 3, node 0. I.e., the red path. Given a node p 1 ’s request chain, define a variant function: p1p1 p2p2 p3p3 pmpm pos. of p 1 in p 1 ’s queue pos. of p 1 in p 2 ’s queue pos. of p 2 in p 3 ’s queue pos. of p m-1 in p m ’s queue,,,, Node 1’s variant function is [1,1,1]. Node 2’s variant function is [1,2]. Node 3’s variant function is [2,1]. If a request message is in transit from p m, then append n+1.
10
Discrete Algs for Mobile Wireless Sys10 Correctness of ME Algorithm èfinite number of calls to RaiseHt èeventually DAG is token-oriented and stays that way èeventually node i’s request chain includes the token holder èvariant function for a particular request keeps decreasing, since nodes don’t stay in CS forever and thus token is sent and received èeventually variant function reaches [1] and request is granted Assume finite number of link changes.
11
Discrete Algs for Mobile Wireless Sys11 Leader Election in MANETs Problem Statement: Any connected component whose topology is static sufficiently long eventually contains a unique leader [MWV] paper modified TORA: Key observation: when a node detects a partition from the destination (current leader), instead of initiating procedure to quiesce, it elects itself Add a 6th component to the height tuple of TORA But resulting algorithm does not handle concurrent topology changes [ISWW] uses a 7-tuple for height…
12
Discrete Algs for Mobile Wireless Sys12 LE Algorithm: Height Data Structure reference level (RL): tau: either 0 or time when current search for alternative path to leader was initiated oid: either 0 or id of node that started current search r: either 0 (nonreflected) or 1 (reflected) delta: integer to ensure links are directed appropriately to neighbors with same RL leader pair (LP): nlts: negative of time when current leader was elected lid: id of current leader id: node's unique identifier
13
Discrete Algs for Mobile Wireless Sys13 LE Algorithm: Topology Changes When link to j goes down: if no neighbors then elect self else if sink then start new RL send new height to all neighbors When link to j comes up: send height to j
14
Discrete Algs for Mobile Wireless Sys14 LE Algorithm: Response to New Height Message if LP is same then if sink then if all neighbors have same RL then if common RL has r = 0 then reflect RL else if common RL has r = 1 and oid= i then elect self else start new RL else propagate largest RL else // LPs are not same adopt LP if priority send new height to all neighbors
15
Discrete Algs for Mobile Wireless Sys15 LE Algorithm: Subroutines elect self: set height to ((0,0,0),0,(-t,i),i), where t is current time reflect RL: set r to 1 and delta to 0 propagate largest RL (partial reversal): set RL to largest neighboring RL, set delta to 1 less than smallest neighboring delta associated with the new RL start new RL: set RL to (t,id,0) and delta to 0, where t is current time adopt LP if priority: if new LP has newer time or (equal time and smaller lid) then set RL to new RL, delta to one larger than new delta, and LP to new LP
16
Discrete Algs for Mobile Wireless Sys16 Example Execution ABCDEFGH ((0,0,0),4,(-1,H),A) ((0,0,0),3,(-1,H),C) ((0,0,0),2,(-1,H),F) ((0,0,0),1,(-1,H),G) ((0,0,0),0,(-1,H),H) ((0,0,0),2,(-1,H),E) ((0,0,0),3,(-1,H),B) ((0,0,0),2,(-1,H),D) at time 5
17
Discrete Algs for Mobile Wireless Sys17 Example Execution: Start New RL ABCDEFGH ((0,0,0),4,(-1,H),A) ((0,0,0),3,(-1,H),C) ((0,0,0),2,(-1,H),F) ((5,G,0),0,(-1,H),G) ((0,0,0),0,(-1,H),H) ((0,0,0),2,(-1,H),E) ((0,0,0),3,(-1,H),B) ((0,0,0),2,(-1,H),D)
18
Discrete Algs for Mobile Wireless Sys18 Example Execution: Propagate Largest RL ABCDEFGH ((0,0,0),4,(-1,H),A) ((0,0,0),3,(-1,H),C) ((5,G,0),-1,(-1,H),F) ((5,G,0),0,(-1,H),G) ((0,0,0),0,(-1,H),H) ((5,G,0),-1,(-1,H),E) ((0,0,0),3,(-1,H),B) ((5,G,0),-1,(-1,H),D)
19
Discrete Algs for Mobile Wireless Sys19 Example Execution: Propagate Largest RL ABCDEFGH ((0,0,0),4,(-1,H),A) ((5,G,0),-2,(-1,H),C) ((5,G,0),-1,(-1,H),F) ((5,G,0),0,(-1,H),G) ((0,0,0),0,(-1,H),H) ((5,G,0),-1,(-1,H),E) ((5,G,0),-2,(-1,H),B) ((5,G,0),-1,(-1,H),D)
20
Discrete Algs for Mobile Wireless Sys20 Example Execution: Reflect RL ABCDEFGH ((5,G,1),0,(-1,H),A) ((5,G,0),-2,(-1,H),C) ((5,G,0),-1,(-1,H),F) ((5,G,0),0,(-1,H),G) ((0,0,0),0,(-1,H),H) ((5,G,0),-1,(-1,H),E) ((5,G,0),-2,(-1,H),B) ((5,G,0),-1,(-1,H),D)
21
Discrete Algs for Mobile Wireless Sys21 Example Execution: Propagate Largest RL ABCDEFGH ((5,G,1),0,(-1,H),A) ((5,G,1),-1,(-1,H),C) ((5,G,0),-1,(-1,H),F) ((5,G,0),0,(-1,H),G) ((0,0,0),0,(-1,H),H) ((5,G,0),-1,(-1,H),E) ((5,G,1),-1,(-1,H),B) ((5,G,0),-1,(-1,H),D)
22
Discrete Algs for Mobile Wireless Sys22 Example Execution: Propagate Largest RL ABCDEFGH ((5,G,1),0,(-1,H),A) ((5,G,1),-1,(-1,H),C) ((5,G,1),-2,(-1,H),F) ((5,G,0),0,(-1,H),G) ((0,0,0),0,(-1,H),H) ((5,G,1),-2,(-1,H),E) ((5,G,1),-1,(-1,H),B) ((5,G,1),-2,(-1,H),D)
23
Discrete Algs for Mobile Wireless Sys23 Example Execution: Elect Self ABCDEFGH ((5,G,1),0,(-1,H),A) ((5,G,1),-1,(-1,H),C) ((5,G,1),-2,(-1,H),F) ((0,0,0),0,(-14,G),G) ((0,0,0),0,(-1,H),H) ((5,G,1),-2,(-1,H),E) ((5,G,1),-1,(-1,H),B) ((5,G,1),-2,(-1,H),D) at time 14
24
Discrete Algs for Mobile Wireless Sys24 Example Execution: Adopt New LP ABCDEFGH ((0,0,0),3,(-14,G),A) ((0,0,0),2,(-14,G),C) ((0,0,0),1,(-14,G),F) ((0,0,0),0,(-14,G),G) ((0,0,0),0,(-1,H),H) ((0,0,0),1,(-14,G),E) ((0,0,0),2,(-14,G),B) ((0,0,0),1,(-14,G),D)
25
Discrete Algs for Mobile Wireless Sys25 Correctness Proof Relies on several invariant predicates: properties of the global state of the system that are always true Show that if topology changes cease, then eventually a leader-oriented DAG is obtained in each connected component Show that a new leader is not elected "unnecessarily": if a component is a leader-oriented DAG and one topology change occurs, then no node remaining in same component as the old leader elects itself
26
Discrete Algs for Mobile Wireless Sys26 Leader-Oriented DAG Lemma 1: Any node that adopts a LP with timestamp after the last topology change never subsequently becomes a sink. Lemma 2: Any node that elects itself after the last topology change never subsequently becomes a sink. Lemma 3: No node elects itself more than once after the last topology change. Lemma 4: Every node starts a finite number of new RLs after the last topology change.
27
Discrete Algs for Mobile Wireless Sys27 Leader-Oriented DAG Lemma 5: Eventually every node in the component has the same LP. Lemma 6: Eventually no messages are in transit. Lemma 7: Eventually every node has an accurate view of its neighbors' heights.
28
Discrete Algs for Mobile Wireless Sys28 Leader-Oriented DAG Theorem 8: Eventually the component is a leader-oriented DAG. Proof Sketch: Eventually all nodes have same LP (-s,L). Eventually every node has an accurate view of its neighbors' heights. Properties tell us that Node L must be in the component. L and only L has RL (0,0,0) and 0 delta no node has a negative RL L has smallest height, so no outgoing links every node other than L has an outgoing link Since cycles are impossible, L-oriented DAG.
29
Discrete Algs for Mobile Wireless Sys29 Leader Stability Theorem 9: Suppose G' is an L-oriented DAG with no messages in transit and a link goes down at time t. Let resulting component containing L be G. Then, as long as no further topology changes occur, no node in G elects itself. Proof Sketch: Suppose node u becomes a sink at time t and starts new RL (t,u,0).
30
Discrete Algs for Mobile Wireless Sys30 Leader Stability Suppose in contradiction some node elects itself at time t e. Claim 2: No new RL prefix (oid and timestamp) is started between t and t e. Thus the node elected at t e must be u. Let A be nodes in G with a directed path to L at time t (after the link goes down) and B be the remaining nodes. L is in A and u is in B. Claim 3: No node in A becomes a sink between t and t e.
31
Discrete Algs for Mobile Wireless Sys31 Leader Stability At t e, all neighbors of u have RL (t,u,1). By a property, there are no "height tokens" in the system at t e with RL (t,u,0) a node cannot have an unreflected RL while one of its ancestors is reflected By another property, every node with RL (t,u,1) has all its neighbors with RL (t,u,1). But then some node with RL (t,u,1) is a neighbor of some node in A, which cannot have RL (t,u,1) since it never becomes a sink. Contradiction.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.