Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
Part 0: Part 0: An overview Part 1: Part 1: Lower bounds Part 2: Part 2: Computing in spite of faults Part 3: Part 3: Detecting faults Part 4: Part 4: Self-stabilization 55 GSSI - Feb 2016
message passing (fifo) asynchronous x x x x 56GSSI - Feb 2016 A. Leader election – basic algorithms and upper bounds Leader election = maximum finding
Unidirectional ring phases, unique execution GSSI - Feb
Bidirectional ring sense of direction L R L L L L L L L R R R R R R R GSSI - Feb
Sense of Direction : For each process p in a bidirectional ring, its left and right neighbors are termed left(p) and right(p) respectively. If right(left(p)) = p for every p, then there is a sense of direction (otherwise – no sense of direction) GSSI - Feb
Bidirectional ring no sense of direction R R L L L L L L L R R L R R R R GSSI - Feb
From now: only unidirectional rings The first algorithm that comes to mind is … GSSI - Feb
LeLann’s algorithm GSSI - Feb “All processors send and forward all id’s, until everyone sees its id (and all other id’s). The one whose id is the maximum is the leader”
state := candidate; send (my_id); receive (nid); while nid ≠ my_id do if nid > my_id then state:=no_leader; send (nid); receive (nid); od; if state=candidate then state:=leader. GSSI - Feb
messages: 64 time: 8 My_id nid 1 5 send (my_id); receive (nid); GSSI - Feb My_id nid 5
Theorem: LeLann’s algorithm terminates, and exactly one processor is in state= leader. Message complexity: O(n 2 ) (worst and average) Time complexity: O(n) GSSI - Feb
The first algorithm that comes to mind. GSSI - Feb Chang and Roberts’ algorithm “All processors send their id’s, and then forward only id’s higher than their own. The processor that receives its own id is the leader”
state := candidate; send (my_id); receive (nid); while nid ≠ my_id do if nid > my_id then [ state:=no_leader; send (nid); receive (nid);] od; if state=candidate then state:=leader. GSSI - Feb
messages: = 20 time: 8 GSSI - Feb
Theorem: Chang and Roberts’s algorithm terminates, and exactly one processor is in state= leader. Message complexity: O(n 2 ) (worst) Time complexity: O(n) GSSI - Feb
Theorem: The average message complexity of Chang and Roberts’s algorithm is O(n log n). assume all rings equally probably for the proof – assume id’s 1,2,…, n GSSI - Feb
GSSI - Feb k-1 values < i i x P(i,k) = probability that id i makes exactly k steps x > i k=4
GSSI - Feb Avg number of messages: for i=nfor i<n
GSSI - Feb
Theorem (Pachl, Korach,Rotem): For every algorithm A for maximum finding in asynchronous unidirectional rings, when n is unknown, and every set I of n identities, GSSI - Feb b. Leader election – lower bound on a ring
ring (4, 1, 3, 5 ) (1, 3, 5, 4 ) (3, 5, 4, 1 ) (5, 4, 1, 3 ) GSSI - Feb
messages (4 ) (4,1 ) (4, 1, 3 ) GSSI - Feb
Sequence Prefix of a sequence Concatenation of sequences subsequence of if s.t. C(s) = all cyclic permutations of s |C(s)| = length (s) GSSI - Feb
{ (4, 1, 3, 5 ), (1, 3, 5, 4 ), (3, 5, 4, 1 ), (5, 4, 1, 3 ) } s = (4, 1, 3, 5 ) C(s) = length (s) = 4 (4,1,3) is a prefix of s (1,3) is a subsequence of s GSSI - Feb
Lemma: In every execution of a maximum finding algorithm A, at least one processor must see its own value Proof: assume not. Suppose that in a certain ring s processor a decides it is the maximum without getting such message. Recall: same messages in every execution GSSI - Feb
Assume that in the ring (3,5,4,1) 5 decides it is the maximum without 5 seeing itself. So, may be (5), (5.4),(5,4,1) were sent, but (5,4,1,3) was not. (4 ) (4,1 ) (4,1,3 ) GSSI - Feb
In every execution of a maximum finding algorithm A, at least one processor must see its own value In a ring labeled s, at least one message in C(s) is sent by A (4 ) (4,1 ) (4,1,3 ) (4,1,3,5 ) GSSI - Feb
– set of all finite sequences of distinct integers For GSSI - Feb
s = (4, 1, 3, 5 ) E={(4,5),(3,5),(5,4,1),(3),(6,2),(5,4) } N(s,E) = 4 N 1 (s,E) = 1 N 2 (s,E) = 2 N 3 (s,E) = 1 N k (s,E) = 0 for k ≥ 4 GSSI - Feb
Definition: A setis exhaustive if it has the following two properties: Prefix property: if then for every prefix s of u. Cyclic permutation property: GSSI - Feb
is exhaustive: Prefix property: if then for every prefix s of u. Cyclic permutation property: Example: the set GSSI - Feb
E contains also the following: (4), (4,1),(4,1,3), (1), (3), (5),(5,4),(5,4,1),(5,4,1,3) Q: What is E? A: E is the set of messages sent by the Chang & Roberts’ algorithm! GSSI - Feb
Lemma: Let such that is a prefix of and, and let A be a maximum finding algorithm. If in the execution of A on ring a message is sent, then in the execution of A on ring a message is sent. st u u GSSI - Feb
Theorem: For every maximum finding algorithm A for unidirectional rings, there exists an exhaustive set E(A), such that, for every ring s, A sends at least N(s,E(A)) messages on s. Proof: Let GSSI - Feb E(A) = { s D | a message s is sent when A executes on ring s. }
1. E(A) is exhaustive 1a. Prefix property GSSI - Feb E(A) = { s D | a message s is sent when A executes on ring s. }
1. E(A) is exhaustive 1b. Cyclic permutation property GSSI - Feb E(A) = { s D | a message s is sent when A executes on ring s. }
2. At least N(s,E(A)) messages sent by A on s GSSI - Feb E(A) = { s D | a message s is sent when A executes on ring s. } End of Proof.
GSSI - Feb
Theorem: For every maximum finding algorithm A for unidirectional rings, and a set of n identities I, we have: GSSI - Feb
GSSI - Feb
Lemma: GSSI - Feb
GSSI - Feb
Theorem: In a unidirectional ring whose size n is unknown, the Chang & Roberts’ algorithm has an optimal average message complexity of GSSI - Feb
- What if n is known? - What if the network is synchronous? Same lower bound of Ω(n log n) messages applies, under some assumptions. GSSI - Feb
Asynchronous network G(V,E) |V| = n processors G is complete : every two processors are connected Distinct ID’s Each processor knows only its ID GSSI - Feb c. Leader election – lower bound on a clique
GSSI - Feb
GSSI - Feb Theorem (Korach, Moran, Zaks): The message complexity of the leader election problem on a clique is Ω(n log n).
f(n) – maximal number of messages for a clique network of size n Informal proof GSSI - Feb
GSSI - Feb
n n 1 GSSI - Feb
n n 1 f(n) GSSI - Feb
nn 1 f(n) GSSI - Feb
n n 1 O(n) GSSI - Feb
GSSI - Feb
n n GSSI - Feb
GSSI - Feb
n n GSSI - Feb xixi yjyj yiyi xjxj (n 2 ) disjoint squares, one message on each, hence a (n 2 ) lower bound
GSSI - Feb d. Lower bound on bit complexity
GSSI - Feb References Gerard Le Lann, Distributed Systems - Towards a Formal Approach, IFIP E. Chang and R. Roberts, An improved algorithm for decentralized extrema-finding in circular configurations of processes, CACM, J. Pachl, E. Korach and D. Rotem, Lower bounds for distributed maximum-finding algorithm, JACM, E. Korach, S. Moran and S. Zaks, Optimal lower bounds for some distributed algorithms for a complete network of processors, 1987