Distributed Systems
Distributed Systems
in Synchronous Networks
Mitsou Valia
National Technical University of Athens
School of Applied Mathematics and Physics
1/66
Distributed Computing
Distributed computing is decentralised and
parallel computing, using two or more computers
communicating over a network to accomplish a
common task.
The collaborating processes are often identical.
One of the central problems is
2/66
Leader Election
3/66
Networks
The timing model:
Synchronous
Asynchronous
Partially synchronous
4/66
5/66
Complexity measures
Time complexity: the number of the rounds until
all outputs are produced or all the processes
halt.
Communication complexity: the number of nonnull messages that are sent during the
execution.
7/66
8/66
Setting
The network graph is a directed ring (unidirected or
bi-directed) consisting of n nodes (n may be unknown
to the processes).
Processes run the same deterministic algorithm
The only piece of information supplied to the
processes is a unique integer identifier (UID).
UIDs may be used
In comparisons only (comparison-based algorithms)
In comparisons and other calculations (non-comparisonbased).
9/66
Time
Complexity
O(n)
O(n)
ML (06)
O(n)
Algorithm
TimeSlice
Lower
bound
O(n umin)
Msg Complexity
Restrictions
O(n2)
O(nlogn)
O(nlogn) (better
constant)
Bidirectional
O(n)
Noncomparison
based
Comparison-based Algorithm
The size of the ring is unknown to the processes
Unidirectional Ring
It elects the process with the maximum UID
11/66
LCR Example
4
7
3
6
13/66
14/66
The HS Algorithm
Comparison-based Algorithm
The size of the ring is unknown to the processes
Bi-directional Ring
It elects the process with the maximum UID
15/66
The HS Algorithm
Description
Each process operates in phases 0, 1, 2...
In each phase k, process i sends tokens with its
UID in both directions to travel distance 2k and
return back to it.
If both tokens return then process i continues in
phase k+1.
16/66
17/66
18/66
HS Example (phase 0)
All
the 20
nodes
19/66
HS Example (phase 1)
15
19
20
18
16
12
17
20/66
HS Example (phase 2)
15
20
18
16
17
21/66
HS Example (phase 3)
20
17
22/66
HS Example (phase 4)
20
23/66
HS Example (phase 5)
20 is the
LEADER
24/66
Complexity Analysis
Time Complexity: O(n)
Message Complexity: O(nlogn)
25/66
Distributed Algorithms in a
General Synchronous Network
26/66
27/66
FloodMax Algorithm
Every process keeps the maximum UID it has
seen so far (initially its own).
At each round, each process sends this
maximum value to every outgoing neighbor.
After diam rounds if the maximum value is the
processs UID then it elects itself the leader,
otherwise it is a non-leader.
28/66
Complexity Analysis
29/66
34/66
35/66
15
3
9
13
10
14
12
2
7
16
11
36/66
15
3
9
13
10
14
12
2
7
16
11
37/66
15
3
9
13
10
14
12
2
7
16
11
38/66
15
3
9
13
10
14
12
2
7
16
11
39/66
(1,1,2)
1
(1,1,3)
(1,2,3)
3
41/66
42/66
Leader Election in
Anonymous Rings
43/66
General
Lemma: If the network is symmetric (i.e. a ring)
and anonymous (the processes havent UIDs)
then it is impossible to elect a leader by a
deterministic algorithm. [by Angluin (1980)]
44/66
46/66
a-1 = 1/10
c=2
0.04
0.37
0.35
0.83
0.64
0.08
0.22
0.53
0.93
47/66
Useless phase
a-1 = 1/2
c=2
0.88
48/66
a-1 = 1/2
c=1
0.69
49/66
50/66
Proof:
1,
Xi a random variable, X i =
a c
a 1
1
0, 1 a
a c
P[X = c ] = a 1 a 1
c
a c
= p ( a, c )
51/66
53/66
The Model
Full- or Perfect-Information Model [BL 90]:
There is an adversary that controls t players
The adversary has unlimited computational
power.
Communication between players is by
broadcast.
Reliable delivery of messages.
The identity of the sender is protected.
The adversary has complete knowledge of
the state of the protocol at any given
54/66
moment.
The Network
We assume an asynchronous network with
synchronization points :
Computation proceeds in rounds.
In each round processes send messages.
During a round we cant force processes to act
simultaneously.
Messages of round i precede those of round i+1.
Within a round, all cheaters have the opportunity
to wait until they receive messages from all
honest players and then send their own.
55/66
Example
A Leader Election Protocol of n processes (Baton
Passing [Saks 89]):
In every round the baton is randomly passed to a
process that hasnt yet received it.
The last process left with the baton becomes the
leader.
n 1 n 2 2 1 1
P(i ) =
L =
n n 1 3 2 n
If there are cheaters, when they take the baton they give
it to an honest process, in order to increase the
probability of a cheater to be elected.
Baton Passing lasts n-2 rounds.
56/66
Failure probability
Let P(n,t) be a leader election protocol between n
processes, t of which are corrupted.
failP(n,t): the probability that one of the cheaters is
elected.
Proposition: For any n, any t 1 and any leader
election protocol P :
1. failP(n,t) is non-decreasing in t.
2. failP(n,t) t/n
3. failP(n, n/2 ) =1
57/66
Resilience
Resilience: How many cheaters are allowed in order
for the protocol to guarantee that an honest player
can be elected with positive probability.
Definition: P is resilient for t=b(n) iff
for all suitably large n
failP(n,b(n)) 1 .
However,
If t 1 then failP(n,t)>1/4
(P is the Lightest Bin protocol
fail(n,t)
1
1-
t
58/66
Cheaters Edge
Cheaters edge: The factor that failP(n,t) increases by
cheating. (Antonakopoulos 2006)
Definition: edgeP(n,t) = n/t failP(n,t)-1 (0)
Example: Assume a fair leader election protocol
If edge = 1 n/t failP(n,t) 1 = 1
n/t failP(n,t) = 2
failP(n,t) = 2 t/n
59/66
Protocol
Condition
rounds
P*
t (n/logn)
P#
t (n/(lognloglogn))
5logn
P+
polylogn
65/66
66/66