1 / 95

Leader Election in Rings

Leader Election in Rings. A Ring Network. Sense of direction. left. 2. 1. 1. right. 2. 2. 1. 1. 2. 2. 1. 1. 2. 2. 1. 1. 2. Links are bi-directional for messages. At most one message in each direction. 2. 1. 1. 2. 2. 1. 1. 2. 2. 1. 1. 2. 2. 1. 1. 2.

ritaa
Download Presentation

Leader Election in Rings

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Leader Election in Rings

  2. A Ring Network

  3. Sense of direction left 2 1 1 right 2 2 1 1 2 2 1 1 2 2 1 1 2

  4. Links are bi-directional for messages At most one message in each direction 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2

  5. Anonymous Ring 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2

  6. 2 8 1 1 1 2 2 2 1 1 5 2 2 6 1 1 3 2 2 4 7 1 1 2 Eponymous (non-anonymous) Ring

  7. Leader Election Initial state Final state leader

  8. Leader election algorithms are affected by: Anonymous Ring Eponymous Ring The size of the network is known The size of the network is not known Synchronous Algorithm Asynchronous Algorithm

  9. Synchronous Anonymous Rings Every processor runs the same algorithm Every processor does exactly the same execution

  10. Initial state Final state leader If one node is elected a leader, then every node is elected a leader

  11. Conclusion 1: Final state Leader election cannot be solved in synchronous anonymous rings leader

  12. Conclusion 2: Final state Leader election cannot be solved in asynchronous anonymous rings either leader Why? The asynchronous ring may behave Like the synchronous ring

  13. Asynchronous Eponymous Rings The maximum id node is elected leader 8 1 2 5 6 3 4 7

  14. Each node sends a message with its id to the left neighbor 1 8 8 1 5 2 2 5 6 3 6 3 4 7 7 4

  15. If: message received id current node id Then: forward message 5 8 1 2 8 5 6 7 3 4 7 6

  16. If: message received id current node id Then: forward message 8 1 7 2 5 6 8 3 4 7

  17. If: message received id current node id Then: forward message 7 8 1 2 5 6 3 4 7 8

  18. If: message received id current node id Then: forward message 8 1 2 5 6 3 4 8 7

  19. If: a node receives its own message Then: it elects itself a leader 8 8 1 2 5 6 3 4 7

  20. If: a node receives its own message Then: it elects itself a leader 8 1 leader 2 5 6 3 4 7

  21. The leader sends a message in the network declaring itself as the “leader of the ring” 8 1 leader 2 5 6 3 4 7

  22. nodes Time complexity: 8 1 leader 2 5 6 3 4 7

  23. Message complexity: nodes worst case scenario: n 1 n-1 2 n-2 n-3

  24. Message complexity: nodes n 1 messages n-1 2 n-2 n-3

  25. Message complexity: nodes n 1 messages n-1 2 n-2 n-3

  26. Message complexity: nodes n 1 messages n-1 2 n-2 n-3

  27. Message complexity: nodes Total messages: n 1 n-1 2 n-2 n-3

  28. Notes: does not need to be known to the algorithm The algorithm can be converted to asynchronous

  29. An O(n log n) Mess. Algorithm Again, the maximum id node is elected leader 8 1 2 5 6 3 4 7

  30. nodes 8 nodes 1 2 5 6 3 4 7

  31. Phase 1: send id to 1-neighborhood 1 8 8 1 8 5 2 2 1 2 5 6 5 6 3 4 6 3 3 7 4 7 7 4

  32. If: received id current id Then: send a reply 8 1 2 5 6 3 4 7

  33. If: a node receives both replies Then: it becomes a temporal leader 8 1 2 5 6 3 4 7

  34. Phase 2: send id to 2-neighborhood 8 8 1 8 2 5 5 6 5 6 6 3 7 4 7 7

  35. If: received id current id Then: forward the message 8 6 1 8 5 2 5 8 6 7 3 7 6 4 5 7

  36. At second step: If: received id current id Then: send a reply 8 1 2 5 6 3 4 7

  37. If: a node receives both replies Then: it becomes a temporal leader 8 1 2 5 6 3 4 7

  38. Phase 3: send id to -neighborhood 8 1 8 2 5 8 7 7 6 3 4 7

  39. If: received id current id Then: forward the message 8 1 8 2 5 8 7 7 6 3 4 7

  40. At the step: If: received id current id Then: send a reply 8 1 2 5 6 3 4 7

  41. If: a node receives both replies Then: it becomes the leader 8 1 2 5 6 3 4 7

  42. 8 1 leader 2 5 6 3 4 7

  43. In general: nodes phases 8 1 leader 2 5 6

  44. Phase i: send id to -neighborhood 8 1 leader 2 5 6

  45. Time complexity The leader spends time in Phase 1:2 Phase 2:4 … Phase i: … Phase log n: Total time:

  46. Message complexity Messages per leader Max #leaders Phase 1:4 Phase 2:8 … Phase i: … Phase log n:

  47. Messages per leader Max #leaders Phase 1:4 Phase 2:8 … Phase i: … Phase log n: Total messages:

  48. Notes: The algorithm does not need to know It can be converted to an asynchronous algorithm

  49. An Mess. Synchronous Algorithm is known The node with smallest id is elected leader There are rounds: • If in round there is a node with id • this is the new leader • the algorithm terminates

  50. Round 1 ( time steps): no message sent 48 9 22 15 nodes 16 33 24 57

More Related