Upload
armani-bourne
View
222
Download
0
Embed Size (px)
Citation preview
Distributed Computing
1. Lower bound for leader election on a complete graph
Shmuel [email protected]
©
Model
Asynchronous network G(V,E) |V| = n processorsG is complete : every two
processors are connectedDistinct ID’sEach processor knows only its ID
The algorithm
The same algorithm to all processors
The algorithm includes three types of actions (events):Sending a massageReceiving a massageProcessing information
Theorem: The message complexity
of the leader election problem
on a complete network is (n log n). W
KMZ
f(n) –
maximal number of messages for a complete network of size n
We show that
f (2n+1) 2f (n) + O(n)³
Informal proof
This implies that f or infi nitely many
n's f (n) c nlogn f or some c>0³
hence
f (n) = (n log n)W
n n
1
n n
1f(n)
f (2n+1) f (n) ³
n n
1 f(n)
f (2n+1) f (n) + f (n)³
n n
1
O(n)
f (2n+1) f (n) + f (n) + O(n)³
A send event is identified with the triple (v,e,m) , where v is the node sending message m on edge e.
Formal proof
ve
Given an algorithm, consider only the events of sending messages.
SEND sequence
For each execution of the algorithm:SEND = {send1,send2,…,sendk}
is the sequence of send events that occurred in the execution, in their order.
for each algorithm there are usually many different executions, thus many different SEND sequences.
NEW(SEND)
NEW(SEND) = {new1,new2,…,newm}
is the subsequence of SEND, where each newi is a send event that uses an unused edge.
(An edge is used if a message has already been sent along it from either end )
SEND(t) – the prefix of length t of SEND NEW(t) – the prefix in length t of NEWSEND(t’), for t’>t, is an extension of
SEND(t) SEND is a completion of SEND(t)
Example
V = (1,2,3,4)E = (a,b,c,d,e,f)
a
b
cd e f
1
4 3
2a
b
cd f
1
4 3
21
4 3
2
SEND = {NEW = {
a
m1
(1,a,m1),(1,a,m1),
1
4 3
21
4 3
2
SEND = {(1,a,m1),NEW = {(1,a,m1),
b
m2 (4,b,m2),(4,b,m2),
1
4 3
21
4 3
2
SEND = {(1,a,m1),(4,b,m2),NEW= {(1,a,m1),(4,b,m2),
a
m3
(2,a,m3),
1
4 3
21
4 3
2
SEND = {(1,a,m1),(4,b,m2),(2,a,m3),NEW= {(1,a,m1),(4,b,m2),
d m4(4,d,m4)(4,d,m4)
1
4 3
21
4 3
2
SEND = {(1,a,m1),(4,b,m2),(2,a,m3),(4,d,m4),
NEW= {(1,a,m1),(4,b,m2),(4,d,m4),
f
m5
(2,f,m5),(2,f,m5),
1
4 3
21
4 3
2
SEND = {(1,a,m1),(4,b,m2),(2,a,m3),(4,d,m4),(2,f,m5), NEW = {(1,a,m1),(4,b,m2),(4,d,m4),(2,f,m5)
d m6
(1,d,m6)
end
So we got:
SEND={(1,a,m1),(4,b,m2),(2,a,m3),(4,d,m4),(2,f,m5),(1,d,m6)} = {send1, send2, send3, send4, send5, send6}NEW =
{send1, send2, send4, send5}SEND(2) = {send1, send2}NEW(3) = {send1, send2, send4}SEND(0) = NEW(0) = { }
for every possible execution of A on G there is NEW.
EX(A,G) is all the prefixes of all possible NEWs.
Global algorithm
Given G, and an execution,G(NEW(t)) is the graph with same nodes but
contains only edges that were used in NEW(t).
Algorithm A is global if for every execution of A, G(NEW) is connected.
Clearly, algorithm for leader election must be global.
1
4 3
2a
b
df
1
4 3
2a
b
d
In the previous example:
NEW ={(1,a,m1),(4,b,m2),(4,d,m4),(2,f,m5)}
=> G(NEW) is the following graph:
Can we say that A is a global algorithm?
Axioms
Some axioms hold for every algorithm A and every graph G (not necessarily complete).
For the next axiom :
How do we start?
Axiom 1
The empty sequence {} is in EX(A,G).
For the next axiom :
Asynchrony in the network
Axiom 2
1 2
1 2
1 2
I f and do not
interf ere with each other,
and , EX(A,G),
then EX(A,G).
s s
s s
s s
Î
× Î
1 2
1 2
and do not
interf ere with each other
if no two edges in and
share any endpoint.
s s
s s
For the next axiom :
A node cannot distinguish between unused edges
Axiom 3
I f EX(A,G), with a last
element (v,e,m) , and e' is an
used edge adjacent to v,
and ' is obtained f rom
by replacing (v,e,m) by (v,e' ,m),
then ' EX(A,G).
s
s s
s
Î
Î
v
e
e’
(v,e,m)
(v,e’,m)
For the next axiom :
So far – EX(A,G) could be empy.
For global algorithms…
Axiom 4
I f EX(A,G) and C a proper
subset of V containing all the
non-isolated nodes in G( ),
then there is an extension '
of in which the fi rst message
(v,e) in ' - satisfi es v C.
s
s
s
s
s s
Î
Î
v
C
Edge complexity, message complexity
The edge complexity e(A) of an algorithm A (on a graph G) is the maximal length of NEW, over all possible executions of A.
The message complexity m(A) of an algorithm A (on a graph G) is the maximal length of SEND, over all possible executions of A.
( ) ( )m A e A³
Lemma
Let A be a global algorithm f or a complete
graph G(V,E), and let U V .
Then there exists EX(A,G) such that
G( ) has one connected component whose
set of vertices is U , and the vertices in
s
s
¹ ¹ÆÌ Ì
Î
V-U are isolated
U
V-Us
start with = .
repeat
extend the execution
by a message f rom a node
in U (by axiom 4)
to a node in U (by axiom 3) .
until G( ) contains one conected
component, whose vertices are U.
Ex
s
s
s
Æ
tend until the execution terminatess
U
V-Us
e(U)
By the lemma, for every subset U of V we can find at least one execution of A that will first make U a connected component and leave all other nodes isolated.
From all the executions that do so we will choose the one that uses the maximal number of edges, and denote that number e(U).
I s it possible that U=U'
but e(U) e(U') ?¹
Yes.
Ex: give an example!
e(k)
e(k)= min(e(U)| U V, |U|=k)Í
e(n) is the lower bound for edge complexity (and therefore for message complexity) of A.
Claim:
nFor k< :
2
e(2k+1) 2e(k) + k + 1³
1 2
1 2
Proof :Let U be a disjoint union
U=U U { }
s.t. |U | | U |=k and e(U)=e(2k+1).
vÈ È
=
So, we got execution that creates one connected component U of size 2k +1, and
( ) (2 1) 2 ( ) 1e U e k e k k³ + ³ + +
With the initial condition of e(1) = 0 we have for n = 2t – 1:
1 1( ) ( 1)log( ) ( log )
2 2n
e n n n n+
³ + = W
( ) ( log )e m n nÞ = W
hence, fi nding a leader,
or a spanning tree, is (n log n)W
2
Also shown:
fi nding a minimum spanning tree
is (n )W
n n
1 1
0
1 1
0
0
0
1
1
0
References
E. Korach, S. Moran and S. Zaks Optimal lower bounds for some
distributed algorithms for a complete network of processors, 1987