Distributed Algorithms - PowerPoint PPT Presentation

About This Presentation
Title:

Distributed Algorithms

Description:

Father. Ack. BFS: Dijkstra. In phase k: Initiator sends a packet Pulse to its children. ... receives Ack from all its children send Ack to its father father[v] ... – PowerPoint PPT presentation

Number of Views:552
Avg rating:3.0/5.0
Slides: 36
Provided by: mans7
Category:

less

Transcript and Presenter's Notes

Title: Distributed Algorithms


1
Distributed Algorithms
  • Broadcast and spanning tree

2
Model
  • Node Information
  • Adjacent links
  • Neighboring nodes.
  • Unique identity.
  • Graph model undirected graph.
  • Nodes V
  • Edges E
  • Diameter D

3
Model Definition
  • Synchronous Model
  • There is a global clock.
  • Packet can be sent only at clock ticks.
  • Packet sent at time t is received by t1.
  • Asynchronous model
  • Packet sent is eventually received.

4
Complexity Measures
  • Message complexity
  • Number of messages sent (worst case).
  • Usually assume small messages.
  • Time complexity
  • Synchronous Model number of clock ticks
  • Asynchronous Model
  • Assign delay to each message in (0,1.
  • Worse case over possible delays

5
Problems
  • Broadcast - Single initiator
  • The initiator has an information.
  • At the end of the protocol all nodes receive the
    information
  • Example Topology update.
  • Spanning Tree
  • Single/Many initiators.
  • On termination there is a spanning tree.
  • BFS tree
  • A minimum distance tree with respect to the
    originator.

6
Basic Flooding Algorithm
  • Initiator
  • Initially send a packet p(info) to all neighbors.
  • Every node
  • When receiving a packet p(info)
  • Sends a packet p(info) to all neighbors.

7
Basic Flooding Example
8
Basic Flooding Correctness
  • Correctness Proof
  • By induction on the distance d from initiator.
  • Basis d0 trivial.
  • Induction step
  • Consider a node v at distance d.
  • Its neighbor u of distance d-1 received the info.
  • Therefore u sends a packet p(info) to all
    neighbors (including v).
  • Eventually v receives p(info).

9
Basic Flooding Complexity
  • Time Complexity
  • Synchronous (and asynchronous)
  • Node at distance d receives the info by time d.
  • Message complexity
  • There is no termination!
  • Message complexity is unbounded!
  • How can we correct this?

10
Basic Flooding Improved
  • Each node v has a bit sentv, initially
    sentvFALSE.
  • Initiator
  • Initially Send packet p(info) to all neighbors
    and set sentinitiatorTRUE.
  • Every node v
  • When receiving a packet p(info) from u
  • IF sentvFALSE THEN
  • Send packet p(info) to all neighbors.

11
Basic Flooding Improved
  • Message Complexity
  • Each node sends once on each edge!
  • Number of messages equals to 2E.
  • Time complexity
  • Diameter D.
  • Drawbacks
  • Termination detection

12
Spanning tree
  • Goal
  • At the end of the protocol have a spanning tree
  • Motivation for building spanning tree
  • Construction costs O(E).
  • Broadcast on tree only V-1 messages.

13
Spanning tree Algorithm
  • Data Structure
  • Add to each node v a variable fatherv.
  • Initially fatherv null.
  • Each node v
  • When receiving packet p(info) from u and
    fatherv null
  • THEN Set father vu.

14
Spanning Tree Example
15
Spanning tree Algorithm Correctness
  • Correctness Proof
  • Every node v (except the initiator) sets
    fatherv.
  • There are no cycles.
  • Is it a shortest path tree?
  • Synchronous
  • Asynchronous

16
Flood with Termination
  • Motivation Inform Initiator of termination.
  • Initiator
  • Initially Send packet p(info) to all neighbors
    and set setinitiatorTrue
  • Non-Initiator node w
  • When receiving a packet p(info) from u
  • IF sentwFALSE
  • THEN fatherwu send packet p(info) to all
    neighbors (except u).
  • ELSE Send Ack to u.
  • After receiving Ack from all neighbors except
    fatherw
  • Send Ack to fatherw.

17
Flood with Termination Correctness
  • Tree Construction Proof as before.
  • Termination
  • By induction on the distance from the leaves of
    the tree.
  • Basis d0 (v is a leaf).
  • Receives immediately Ack on all packets (except
    fatherv).
  • Sends Ack packet to fatherv.
  • Induction step
  • All nodes at distance d-1 received and sent Ack.
  • Nodes at distance d will eventually receive Ack,
  • and eventually will send Ack.

18
DFS Tree
  • Data Structure in node v
  • Edge-statusv,u for each neighbor u.
  • Possible values are NEW,SENT, Done.
  • Initially statusv,uNEW.
  • Node-statusv.
  • Possible Values New, Visited, Terminated
  • Initially Node-StatusvNEW (except the
    Initiator which have Node-StatusinitiatorVisite
    d).
  • Parentv Initially ParentvNull
  • Packets type
  • Token traversing edges.

19
DFS Algorithm
  • Token arrives at a node v from u
  • Node_StatusvVisited Edge_Statusv,uNEW
  • Edge_Statusv,uDone Send token to u.
  • Node_StatusvVisited Edge_Statusv,uSent
  • Edge_Statusv,uDone.
  • () IF for some w Edge_Statusv,wNew THEN
  • Edge_Statusv,wSent Send token to w.
  • ELSE Node_StatusTerminated send token to
    parentv.
  • If v is the initiator then DFS terminates
  • Node_StatusvNew
  • Parentvu Node_StatusvVisited
    Edge_Statusu,vSent
  • Same as Node_StatusvVisited from ()

20
DFS Example
21
DFS Tree Performance
  • Correctness
  • There is only one packet in transit at any time.
  • On each edge one packet is sent in each
    direction.
  • The parent relationship creates a DFS tree.
  • Complexity
  • Messages 2E
  • Time 2E
  • How can we improve the time to O(V).

22
Spanning Tree BFS
  • Synchronous model have seen.
  • Asynchronous model
  • Distributed Bellman-Ford
  • Distributed Dijkstra

23
BFS Bellman-Ford
  • Data structure
  • Each node v has a variable levelv.
  • Initially levelinitiator0 at the initiator and
    levelv? at any other node v.
  • Variable parent, initialized at every node v to
    parentv null.
  • Packet types
  • layer(d) there is a path of length at most d to
    the initiator.

24
BFS Bellman-Ford Algorithm
  • Initiator
  • Send packet layer(0) to all neighbors.
  • Every node v
  • When receiving packet layer(d) from w
  • IF d1 lt levelv THEN
  • Parentvw
  • Levelvd1
  • Send layer(d1) to all neighbors (except w).

25
BFS Bellman-Ford Correctness
  • Correctness Proof
  • Termination Each node u updates levelu at most
    V times.
  • Relationship parent creates a tree
  • After termination if parentuw then
    levelulevelw1 BSF Tree
  • Complexity
  • Time O(Diameter)
  • Messages O(DiameterE)

26
BFS Bellman-Ford Example
27
Bellman Ford Multiple initiators
  • Set distance (id-initiator,d).
  • Use Lexicographic ordering.
  • Each node can change level at most
  • Number of initiators V
  • At most V2

28
BSF Dijkstra Illustrated
k1
1
k
29
BFS Dijkstra
  • Asynchronous model
  • Advance one level at a time.
  • Go back to root after adding each level.
  • Time O( D2 )
  • Messages O( E D V )
  • DDiameter

30
BFS Dijkstra
  • Data Structures
  • Fatherv the identity of the father of v.
  • Childv,u u is a child of v in the tree.
  • Upv,u u is closer to the initiator than v.
  • Packets
  • Pulse
  • forward
  • Father
  • Ack.

31
BFS Dijkstra
  • In phase k
  • Initiator sends a packet Pulse to its children.
  • Every node of the tree that receives a packet
    Pulse sends a packet Pulse to its children.
  • Every leaf v of the tree
  • Sends a packet forward to all neighbors w s.t.
    upv,wFALSE.
  • When receiving packet fatheru from u set
    childv,uTRUE.
  • When receiving either Ack or fatherw from all
    neighbors w with upv,wFALSE send Ack to
    fatherv.
  • Every internal node v that receives Ack from all
    its children send Ack to its father fatherv.

32
BFS Dijkstra
  • A node u that receives a forward packet (from v)
  • First forward packet
  • Sets fatheruv
  • Sends fatheru to node v.
  • second (or more) forward packet
  • Send Ack to v.

33
BFS Dijkstra
  • End of phase k
  • Initiator receives Ack from all its children.
  • Initiator start phase k1.
  • Termination
  • If no new node is reached in last phase.

34
BFS Dijkstra
  • Correctness
  • Induction on the phases
  • Asynchronous model.
  • Time O( D2 )
  • Messages O( E D V )
  • DDiameter

35
Conclusion
  • Broadcast
  • Flooding
  • Flooding with termination
  • Spanning tree
  • Unstructured spanning tree (using flooding)
  • DFS Tree
  • BFS Tree
Write a Comment
User Comments (0)
About PowerShow.com