Download presentation
Presentation is loading. Please wait.
Published byAdam Lynch Modified over 9 years ago
1
Leader Election and Mutual Exclusion Algorithms for Wireless Ad Hoc Networks. CPSC 661 Distributed Algorithms Abhishek Gaurav Alok Madhukar
2
Part 1: Leader Election Algorithms for Wireless Ad Hoc Networks - What is a mobile ad hoc network? - Use of Leader election in mobile systems - Challenges in making algorithms for mobile ad hoc network. - Model and Assumptions - Earlier Algorithms - Overview of Leader Election Algorithm - The Algorithm - Conclusion
3
Wireless Networks – Operating Modes Infrastructure Mode Ad Hoc Mode
4
Wireless Ad Hoc Networks - Characteristics - Wireless - Highly Mobile - No Access Points/Infrastructure - All nodes are peers - All nodes are routers - Network is formed dynamically
5
Wireless Ad Hoc Networks - Routing Alok Ian
6
Wireless Ad Hoc Networks - Routing Alok Ian Gabriel
7
Wireless Ad Hoc Networks - Routing Alok Ian Abhishek Gabriel Lisa
8
Use of Leader Election in Mobile Systems - Useful building block when failures are frequent - Lost Token in Mutual Exclusion - Group Communication Protocols - New Coordinator when Group Membership changes
9
Challenges in making Algorithms for Wireless Ad Hoc Networks - Communication link – function of position, transmission power levels, antenna patterns, co- channel reference levels, etc. - Frequent and unpredictable Topological Changes - Congested Links
10
New Definition Vs Classical Definition - Classical Definition 1. Eventually there is a leader with termination detection 2. There should never be more than one leader - New Definition 1. Any component whose topology is static sufficiently long will eventually have a leader with termination detection 2. There should never be more than one leader for any given component
11
Basic Ideas - Leader-Oriented DAG - Partition from Leader - Merging of Components - Multiple Topology Changes
12
System Model - N independent mobile nodes - Message passing over wireless network - Network – dynamically changing, not necessarily connected, a graph with nodes as vertices and edges between nodes that can communicate
13
Assumptions on System Model - Nodes have unique node identifiers - Communication links are bidirectional, reliable, FIFO - Link level protocol: aware of the neighbors - One Topological change at a time
14
Problem Statement - For every connected component C of the topology graph, there is a node l in C, s.t. lid i = l for each node i in C. - Eventually, each connected component is a directed acyclic graph with the leader as the single sink (leader-oriented DAG)
15
Existing Algorithms - Shortest Path and Adaptive Shortest Path Algorithms - Designed for static and quasi-static hard-wired links - Do not react fast enough to maintain routing - Only 1 path for routing between any source/destination pair - Link State Algorithms - Maintain multiple path for routing - Time and communication overhead associated with maintaining full topological knowledge at each router makes them impractical
16
Introduction of Link Reversal Routing - Objectives - Executes in a distributed environment - Provides loop-free routes - Provides multiple routes (to alleviate congestion) - Establishes routes quickly - Minimize communication overhead by localizing algorithmic reaction to topological changes when possible
17
Link Reversal Routing (LRR) - Approach - LRR Algorithms maintain only distributed state information sufficient to constitute an Directed Acyclic Graph (DAG), rooted at the destination - Maintenance of a distributed DAG is desirable, as it guarantees loop-freedom and can provide participating nodes with multiple, redundant routes to the destination - Route maintenance is triggered when a node i loses the link to its last downstream neighbor
18
Basis - Gafni – Bertsekas Algorithm [1]: 1981 - Temporally Ordered Routing Algorithm (TORA) [2]: 1997
19
Leader Oriented DAG fig. A Leader Oriented DAG Height2 Height1 Reference2 Reference1 Height2 > Height1 Reference2 > Reference1
20
Leader Election Algorithm - An Overview fig. C is in trouble (It has no outgoing link) A B C D E
21
Leader Election Algorithm - An Overview (cont’d…) fig. C becomes originator of a new higher reference level A B C D E
22
Leader Election Algorithm - An Overview (cont’d…) fig. E is in trouble and sees that neighbors have different levels A B C D E
23
Leader Election Algorithm - An Overview (cont’d…) fig. E goes to new reference level and selects height just below C A B C D E
24
Leader Election Algorithm - An Overview (cont’d…) fig. Link from C to E is not reversed, but link from D to E is reversed A B C D E
25
Leader Election Algorithm - An Overview (cont’d…) fig. D in trouble A B C D E
26
Leader Election Algorithm - An Overview (cont’d…) fig. D goes to new reference level and selects height just below E A B C D E
27
Leader Election Algorithm - An Overview (cont’d…) fig. Links C to D and E to D are intact but A to D reverse A B C D E Everyone is happy
28
Leader Election Algorithm - An Overview (cont’d…) fig. Link Break disconnects the component from leader A B C D E Alas!!
29
Leader Election Algorithm - An Overview (cont’d…) fig. B is in trouble since it has lost all outgoing links A B C D E
30
Leader Election Algorithm - An Overview (cont’d…) fig. B selects new height in new (highest) reference level A B C D E
31
Leader Election Algorithm - An Overview (cont’d…) fig. A is in trouble A B C D E A sees something different !! – All neighbors are in higher level
32
Leader Election Algorithm - An Overview (cont’d…) fig. A creates higher sublevel within the new sub-level A B C D E {φ}{φ}
33
Leader Election Algorithm - An Overview (cont’d…) fig. All links to A are reversed A B C D E {φ}{φ}
34
Leader Election Algorithm - An Overview (cont’d…) fig. Higher Sub-level is reflected back to C (originator) A B C D E C knows that there is no route to the leader
35
Leader Election Algorithm - An Overview (cont’d…) fig. C elects itself the leader and propagates the message A B C D E All nodes adjust their height w.r.t. leader
36
Leader Election Algorithm - An Overview (cont’d…) fig. The separated component becomes a leader-oriented DAG A B C D E Everyone is happy again
37
Node Height in LE The height of node i is an ordered six-tuple (lid i, τ i, oid i, r i, δ i, i) - lid i : id of the node believed to be the leader of i’s component - τ i : the “logical time” of link failure, defining a new reference level - oid i : the unique id of the node that defined the reference level - r i : a bit used to divide each of the unique reference levels into two unique sub-levels – reflected and unreflected - δ i : a “propagation” ordering parameter - i: the unique id of the node (τ i, oid i, r i ) represents the reference level and (δ i, i) represents the “delta” or offset w.r.t. reference level. The reference level (-1,-1,-1) is used by the leader of a component to ensure that it is a sink.
38
The Algorithm Node i: - Each step is triggered either by the notification of the failure or formation of an incident link or by the receipt of a message from a neighbor. - Local variable N i : to store its neighbors' ids. When an incident link fails, i updates N i. When an incident link forms, i updates N i and sends an Update message over the link with its current height. - The only kind of message sent is an Update message, which contains the sender's height. - At the end of each step, if i's height has changed, then it sends an Update message with the new height to all its neighbors.
39
The Algorithm (cont’d…) A. When node i has no outgoing links due to a link failure: 1. if node i has no incoming links as well then 2. lid i := i 3. (τ i, oid i, r i ) := (-1,-1,-1) 4. δ i := 0 5. else 6. (τ i, oid i, r i ) := (t, i, 0) // t is the current time 7. δ i := 0
40
The Algorithm (cont’d…) B. When node i has no outgoing links due to a link reversal following reception of an Update message and the reference levels (τ j, oid j, r j ) are not equal for all j є N i : 1. (τ i, oid i, r i ) := max{(τ j, oid j, r j ) I j є N i ) 2. δ i := min{δ j I j є N i and (τ j, oid j, r j ) = (τ i, oid i, r i )} - 1
41
The Algorithm (cont’d…) C. When node i has no outgoing links due to a link reversal following reception of an Update message and the reference levels (τ j, oid j, r j ) are equal with r j = 0 for all j є N i : 1. (τ i, oid i, r i ) := (τ j, oid j, r j ) for any j є N i ) 2. δ i := 0
42
The Algorithm (cont’d…) D. When node i has no outgoing links due to a link reversal following reception of an Update message and the reference levels (τ j, oid j, r j ) are equal with r j = 1 for all j є N i : 1. lid i = i 2. (τ i, oid i, r i ) := (-1, -1, -1) 3. δ i := 0
43
The Algorithm (cont’d…) E. When node i receives an Update message from neighboring node j such that lid i ≠ lid j 1. if lid i > lid j or (oidi = lid j and r i = 1) then 2. lid i = lid j 3. (τ i, oid i, r i ) := (0, 0, 0) 4. δ i := δ j + 1
44
Example (A, -1, -1, -1, 0, A)(F, 2, A, 1, -1, D) (F, 2, A, 1, 0, B) (F, 0, 0, 0, 1, E) (F, -1, -1, -1, 0, F) (F, 0, 0, 0, 1, H) (F, 0, 0, 0, 2, G) fig.1 Node A detects a partition and elects itself as leader
45
Example (cont’d…) (A, -1, -1, -1, 0, A)(A, 0, 0, 0, 1, D) (A, 0, 0, 0, 1, B) (F, 0, 0, 0, 1, E) (F, -1, -1, -1, 0, F) (F, 0, 0, 0, 1, H) (F, 0, 0, 0, 2, G) fig.2 Nodes B and D update their heights Update
46
Example (cont’d…) (A, -1, -1, -1, 0, A) (A, 0, 0, 0, 1, D) (A, 0, 0, 0, 1, B) (A, 0, 0, 0, 2, E) (F, -1, -1, -1, 0, F) (F, 0, 0, 0, 1, H) (F, 0, 0, 0, 2, G) fig.3 Nodes B and E detect link formation and node E changes leader Update
47
Example (cont’d…) (A, -1, -1, -1, 0, A) (A, 0, 0, 0, 1, D) (A, 0, 0, 0, 1, B) (A, 0, 0, 0, 2, E) (A, 0, 0, 0, 3, F) (F, 0, 0, 0, 1, H) (F, 0, 0, 0, 2, G) fig.4 Node F propagates leader change Update
48
Example (cont’d…) (A, -1, -1, -1, 0, A) (A, 0, 0, 0, 1, D) (A, 0, 0, 0, 1, B) (A, 0, 0, 0, 2, E) (A, 0, 0, 0, 3, F) (A, 0, 0, 0, 4, H) (F, 0, 0, 0, 2, G) fig.5 Node H propagates leader change Update
49
Example (cont’d…) (A, -1, -1, -1, 0, A) (A, 0, 0, 0, 1, D) (A, 0, 0, 0, 1, B) (A, 0, 0, 0, 2, E) (A, 0, 0, 0, 3, F) (A, 0, 0, 0, 4, H) (A, 0, 0, 0, 5, G) fig.6 Node G propagates leader change Update
50
Proof of Correctness We believe the proof that each component is a leader – oriented DAG with the assumption of one change at a time can be converted to simple graph-theoretic proof and we are working on it.
51
Problem To solve mutual exclusion problem in wireless ad hoc networks, Nodes communicate with each other by message passing over unreliable communication channels, No shared objects.
52
Solution Approach Solution Approach : Maintaining a token Node having the token enters critical section. Previous solutions Raymond's algorithm not resilient to link failures. Chang's solution does not consider link recovery. Dhamdhere and Kulkarni's solution suffer from starvation
53
Mobile Node Architecture Application Process RequestCS ReleaseCS EnterCS Mutual Exclusion Process LinkUP Send(m) Recv(m) LinkDown Network
54
Notion of Height Each node maintains a 3-tuple height – (h1,h2,i) Heights for each node are distinct. The node identifier i achieves this. Heights are compared lexicographically. Links are logically considered to be directed from higher height node to lower hieght node. Initially node 0 has (0,0,0) and heights for other nodes are initialized to form a DAG.
55
Overview of Algorithm Algorithm is event-driven, Token-holder node enters the critical section, The token holder ensures lowest height in the system, Request for tokens from non-token holding nodes are directed towards the token- holder.
56
Data Structures Each node i maintains : status N myHeight height[j], j ∈ N tokenHolder Next Q receivedLI [j] Forming [j] formHeight [j]
57
Application requests or releases Application Process RequestCS ReleaseCS Mutual Exclusion Process Network
58
Request for CS Application Process I Q
59
Request for CS Application Process RequestCS I i Q
60
Request for CS Application Process RequestCS I i Q tokenHolder = False tokenHolder = True & |Q i | = 1 ForwardRequest() EnterCS
61
Release the CS Application Process I Q
62
Release the CS Application Process ReleaseCS I... Q
63
Release the CS Application Process ReleaseCS I... Q |Q i | > 0 GiveTokenToNext()
64
Request (h) message received Application Process Mutual Exclusion Process Recv(m) Request(h) Network
65
Request (h) msg received Network I Q
66
Request (h) msg received Network Request (h) from j I Q
67
Request (h) msg received Network Request (h) from j I Q ReceivedLI(j) = false ReceivedLI(j) = true Ignore Update : height[j] = h
68
Request (h) msg received Network Request (h) from j I j Q j is higher node
69
Request (h) msg received Network Request (h) from j I j Q tokenHolder = True & ∣ Q ∣ > 0 & status = Remainder GiveTokenToNext()
70
Request (h) msg received Network Request (h) from j I j Q tokenHolder = false tokenHolder = True & ∣ Q ∣ > 0 no links & status = Remainder outgoing GiveTokenToNext() RaiseHeight()
71
Request (h) msg received Network Request (h) from j I j Q tokenHolder = false tokenHolder = True & ∣ Q ∣ > 0 Q = [j] & status = Remainder no links ForwardRequest() outgoing GiveTokenToNext() RaiseHeight()
72
Token (h) message received Application Process Mutual Exclusion Process Recv(m) Token(h) Network
73
Token (h) msg received Token(h) I Q J
74
Token (h) msg received Token(h) I Q J tokenHolder = True ; height[j] = h
75
Token (h) msg received J myHeight.h1 = h.h1 ; myHeight.h2 - 1 I Q
76
Token (h) msg received J myHeight.h1 = h.h1 ; myHeight.h2 - 1 I Q....... LinkInfo()
77
Token (h) msg received J myHeight.h1 = h.h1 ; myHeight.h2 - 1 I Q ∣ Q i ∣ = 0 ∣ Q i ∣ > 0 next i = i GiveTokenToNext()
78
LinkInfo (h) message received Application Process Mutual Exclusion Process Recv(m) LinkInfo(h) Network
79
LinkInfo (h) recvd from j Network LinkInfo(h) I
80
LinkInfo (h) recvd from j Network LinkInfo(h) I receivedLI[j] = True height[j] = h
81
LinkInfo (h) recvd from j Network LinkInfo(h) I receivedLI[j] = True height[j] = h height[j] = h receivedLI[j] = True
82
LinkInfo (h) recvd from j Network LinkInfo(h) I forming[j] = false forming[j] is True and (myHeight ≠ formHeight[j]) LinkInfo(myHeight) to j
83
LinkInfo (h) recvd from j Network LinkInfo(h) I no outgoing links and tokenHolder = False height[j] = h
84
LinkInfo (h) recvd from j Network LinkInfo(h) I no outgoing links ∣ Q i ∣ > 0 and and tokenHolder = False myHeight < height[next] height[j] = h ForwardRequest()
85
Procedure GiveTokenToNext I calls GiveTokenToNext I x Q
86
Procedure GiveTokenToNext I calls GiveTokenToNext I Q next = x
87
Procedure GiveTokenToNext I calls GiveTokenToNext I Q next = x next = i EnterCS
88
Procedure GiveTokenToNext I calls GiveTokenToNext I Q next = x tokenHolder = false; receivedLI=F next = i next ≠ i height[next] = (myHeight.h1, myHeight.h2-1, next) EnterCS Token (myHeight)
89
Procedure GiveTokenToNext I calls GiveTokenToNext I..... Q |Q i | > 0 Request (myHeight)
90
Procedure ForwardRequest () Called when a node i does not hold the token and a request message arrives at i. Next is set to node i's lowest height neighbor i.e. next = l ∈ N : height[l] ≤ height[j], ∀ j ∈ N. Send Request(myHeight) to next.
91
Procedure RaiseHeight() h2 = m+1 h1 = k+2 h2 = m h1 = k+1 h1 = k
92
Procedure RaiseHeight() h2 = m+1 h1 = k+2 h2 = m h1 = k+1 h1 = k
93
Procedure RaiseHeight() h2 = m+1 h1 = k+2 h2 = m h2 = m-1 h1 = k+1 h1 = k
94
Link Failures (link to j detected at i) N i = N i – {j} Delete (Q, j) ; receivedLI[j] = True; If (not tokenHolder) then If (no outgoing links) then CallRaiseHeight() ElseIf (( |Q i | > 0 ) and (next ∉ N i )) then ForwardRequest () // If next has failed send a request
95
Link formation Node i detects a new link to node j, Send LinkInfo(myHeight) to j, Set forming[j] to True, Set formHeight[j] to myHeight.
96
Correctness Proof To Prove : Algorithm ensures mutual exclusion Algorithm does not suffer from starvation : no node is starved from entering the critical section.
97
Correctness Proof (Mutual Exclusion) Theorem 1 : The algorithm ensures mutual exclusion This is because there exists only one token in the system at any time.
98
Correctness Proof contd.. (No Starvation) To prove no starvation After link changes cease, the system will reach a “good” configuration. Variant function is applied to this “good” configuration to show that eventually the node will enter CS “Good configuration” = Token-Oriented DAG Token-Oriented DAG : If ∀ node i, i ∈ {0,....,n-1}, ∃ a directed path originating at node i and terminating at token-holder.
99
Proof Sketch Lemma1 : In every configuration, a DAG is token oriented iff there are no sinks. ( Definitioin 1: A node i is sink if (tokenHolder i = false) and ((myHeight i < height i [j]), for all j ∈ N i ) + Lemma 2 : In every execution with a finite number of link changes, there are finite number of calls to RaiseHeight (). ↓ Lemma 3 : After link change ceases, the logical direction on links imparted by height values will eventually form a token oriented DAG.
100
Proof Sketch contd.. Definition 2: A request chain for node l is defined to be the maximal length list of nodes through which request has passed. p 1 = l → p 2 →.... → p j is a request chain. p j is either token-holder, or a Token messageis in transit to p j, or a Request message is in transit from p j to next pj, or a LinkInfo message is in transit from p j to next pj Lemma 4: Once link changes and calls to RaiseHeight() cease, if a node l's request chain does not include a token holder, then eventually l's request chain will include the token holder.
101
Proof Sketch contd.. Definition 3: A function V l for l is defined to be a vector of integers having m or m+1 elements such that v 1 is position of p 1 in Q p1, and for 1 < j ≤ m, v j is the position of p j-1 in Q pj. If a request message is in transit then v m+1 = n+1. Lemma 5: V l is a variant function; When V l equals, l enters CS. V l never has more than n entries. Request and Token messages decrease V l Theorem 2: When V l equals, l enters CS.
102
References [1] E. Gafni and D. Bertsekas, “Distributed algorithms for generating loop-free routes in networks with frequently changing topology,” IEEE Transactions on Communications, C-29(1):11-18, 1981. [2] Vincent D. Park and M. Scott Corson, “A Highly Adaptive Distributed Routing Algorithm for Mobile Wireless Networks,” Proc. IEEE INFOCOM, April 7-11, 1997. [3] N. Malpani, J.L. Welch, N. Vaidya, “Leader Election Algorithms for Mobile Ad Hoc Networks,” Proc. of the 4 th International Workshop on Discrete Algorithms and Methods for Mobile Computing and Communications, August 2000 [4] J. E. Walter, J. L. Welch, and N. H. Vaidya, “A Mutual Exclusion Algorithm for Ad Hoc Mobile Networks,” ACM and Baltzer Wireless Networks journal, special issue on DialM papers, 2001. [5] J.E. Walter, G. Cao, M. Mohanty, “A K-Mutual Exclusion Algorithm for Wireless Ad Hoc Networks,” POMC 2001, Newport Rhode Island, USA
103
Thank You ! gaurav@cpsc.ucalgary.ca madhukar@cpsc.ucalgary.ca
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.