Top Banner
Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens
113

Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Dec 11, 2015

Download

Documents

Tyler Catchpole
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Distributed Leader Election Algorithms in

Synchronous Ring Networks

Valia Mitsou

National Technical University of Athens

Page 2: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Distributed Computing

Distributed computing is decentralised and parallel computing, where two or more processors communicate over a network to accomplish a common task.

The collaborating processors are often identical. One of the central problems is…

Page 3: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Leader Election

Given a network of processors, exactly one processor should output the

decision that it is the leader.

It is usually required that all non-leader processors are informed of the leader’s election.

Page 4: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

The Synchronous Network Model

Page 5: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Network representation

• Directed Graph G(V,E), |V|= n• Nodes represent processors• Edges represent (directed)

communication channels• Message Passing System• Global Clock (for every tic a step

of the algorithm is executed)

Page 6: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Complexity measures

• Time complexity: the number of the steps until all outputs are produced or all the processors halt.

• Communication complexity: the number of non-null messages that are sent during the execution.

Page 7: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Leader Election in Rings with UIDs

Page 8: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Setting• The network graph is a directed

ring consisting of n nodes (n is unknown to the processors).

• Processors run the same deterministic algorithm.

• The only piece of information supplied to the processors is a unique integer identifier (UID).

Page 9: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Related Work and Important Results

Algorithm Time Complexity

Msg Complexity

LCR (‘79) O(n) O(n2)

HS (’80) O(n) O(nlogn)

Our Algorithm O(n) O(nlogn) (better constant)

Lower bound Ω(n) (trivial) Ω(nlogn) FL (’87)

Page 10: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Our Algorithm

Page 11: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Basic Idea• Every processor starts by sending a

message with its UID

• Nodes which receive a UID greater than their own take on the task of forwarding it around the ring, while the node which initially possessed it becomes inactive.

• The processor that will become the leader is the one with the greatest UID and this will happen when its UID returns to itself after traveling around the ring.

Page 12: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Description

Every processor has the following fields:• Its own UID• The greatest UID it has seen so far• One activity field {active, inactive,

waiting}• One status field {leader, unknown}

Page 13: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Description

• The algorithm is executed in phases 0, 1, 2...

• Every phase k has two parts

Page 14: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

First Part of Phase k

Every active processor i sends a token with the greatest UID it has seen so far to travel for distance at most 2k.

Page 15: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

First Part of Phase k

When a processor receives a UID that is equal to its own UID, it declares itself the leader.

If this is not the case then it compares it with the greatest UID it has seen so far.

Page 16: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

First Part of Phase k

• If the incoming UID is smaller then it discards it.

• If the incoming UID is greater then– It saves this UID as the greatest it has seen so

far.– Either it becomes waiting if it is the incoming

UID’s end of path (it has already traveled distance 2k), or it passes it to the next processor and becomes inactive.

Page 17: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Second Part of Phase k

After this time (2k), if i is still active resends the UID to travel distance 2k and becomes inactive.

• If a waiting processor receives again the same UID after 2k time then it becomes active.

• If not it becomes inactive.

The next phase k+1 begins…

Page 18: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

A Simple Example

Page 19: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 20: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 21: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 22: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 23: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 24: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 25: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 26: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

A More Complicated Example

Page 27: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 28: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 29: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 30: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 31: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 32: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 33: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 34: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 35: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 36: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 37: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 38: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 39: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 40: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 41: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 42: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 43: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 44: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 45: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 46: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 47: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 48: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 49: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 50: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 51: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 52: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 53: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 54: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 55: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 56: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 57: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 58: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 59: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 60: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 61: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 62: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 63: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 64: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 65: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 66: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 67: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 68: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 69: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 70: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 71: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 72: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 73: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 74: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 75: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 76: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 77: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 78: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 79: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 80: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 81: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 82: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 83: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 84: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Complexity Analysis

Page 85: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Execution Time

Total running time = time until maximum UID reaches its initiator (one round = n steps)

But how many phases will be executed until maxUID reaches its initiator?

Page 86: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 87: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 88: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 89: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 90: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 91: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Number of Phases

• f = total number of phases.• 1 + 2 + 4 + … + 2f-1 < n → 2f – 1 < n• 2f+1 – 1 ≥ n• So f ≈ logn

Page 92: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Time Complexity

In every phase i:• 2 parts• 2i steps each part

Total running time2 + 4 + 8 + … + 2f + rest ≤ ≤ 2f+2 – 2 = O(2logn) = = O(n)

2i+1 steps

Page 93: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Messages

• Only an active processor can initiate a message.

• Inactive processors pass the message to the final receiver

Page 94: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 95: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 96: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 97: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 98: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 99: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 100: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 101: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 102: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 103: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 104: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 105: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 106: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 107: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 108: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.
Page 109: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

2i+1

Page 110: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

In phase i+1

2i+1 → 1 active processorn → (n / 2i+1) active processors

• Every active processor causes 2∙2i+1= 2i+2 messages to be sent.

• Total number of messages in this phase:

(n / 2i+1) ∙ 2i+2 ≈ 4n

Page 111: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Message Complexity

• Total number of phases ≈ logn• Number of messages in every

phase ≈ 4n

The total number of messages during the execution is O(nlogn) with a constant factor 4 (improving a previous constant factor 8 in HS).

Page 112: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

Complexity

• Time Complexity: O(n)• Message Complexity: O(nlogn)

For non-leader results we need n extra steps and n extra messages.

Page 113: Distributed Leader Election Algorithms in Synchronous Ring Networks Valia Mitsou National Technical University of Athens.

THANK YOU!