Distributed Algorithms
Tutorial
Roger Wattenhofer
ETH Zurich Distributed Computing www.disco.ethz.ch
Distributed
Algorithms
Message
Passing
Shared
Memory
Example: Maximal Independent Set (MIS)
Given a network with n nodes, nodes have unique IDs.
Find a
Multi-Core Computing
with Transactional Memory
Johannes Schneider and Prof. Roger Wattenhofer
1
Overview
Introduction
Difficulties with parallel (multi-core) programming
A (partial) solution: Transactional Memory
Contention Management
Johannes Schneider a
From Shared Memory
to Message Passing
Stefan Schmid
T-Labs / TU Berlin
Some parts of the lecture, parts of the Skript and exercises will be based on the lectures of
Prof. Roger Wattenhofer at ETH Zurich
and
Prof. Christian Scheideler at University Paderbo
Distributed
Computing
FS 2012
Prof. R. Wattenhofer
Philipp Brandes
Principles of Distributed Computing
Exercise 13: Sample Solution
1
Determining the Median
As stated in the hint, we start with initializing the nodes to give them IDs from 1, . . . , n. No
Distributed
Computing
FS 2013
Prof. R. Wattenhofer
Michael Knig
o
Principles of Distributed Computing
Exercise 13: Sample Solution
1
Pancake Networks
log N
Generally, observe that N = |V (Pn )| = n! O(nn ) n O( log log N ).
a) See Figure 1. For drawing Pn
DDA 2010, lecture 3:
Ramseys theorem
A generalisation of the pigeonhole principle
Frank P. Ramsey (1930):
On a problem of formal logic
. in the course of this investigation it is necessary
to use certain theorems on combinations which have
an independe
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Barbara Keller
Principles of Distributed Computing
Sample Solution to Exercise 13
1
Self-stabilizing Spanning Tree
a) If the whole memory state of all nodes is deleted, nodes need at least R time to build
DDA 2010, lecture 3:
Ramseys theorem
A generalisation of the pigeonhole principle
Frank P. Ramsey (1930):
On a problem of formal logic
. in the course of this investigation it is necessary
to use certain theorems on combinations which have
an independe
Distributed
Computing
FS 2015
Prof. R. Wattenhofer / Michael Knig
o
Principles of Distributed Computing
Exercise 9: Sample Solution
1
Scale Free Networks
a) The node-degree distribution of a graph does not determine the diameter of the graph. This
can be
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Sebastian Brandt
Principles of Distributed Computing
Exercise 11
1
Communication Complexity of Set Disjointness
In the lecture we studied the communication complexity of the equality function. Now we cons
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Sebastian Brandt
Principles of Distributed Computing
Exercise 11: Sample Solution
1
Communication Complexity of Set Disjointness
a) We obtain
M DISJ
=
DISJ
000
001
010
011
100
101
110
111
y
000
1
1
1
1
1
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Laura Peer
Principles of Distributed Computing
Exercise 10
1
Distributed Network Partitioning
In this exercise, we will derive an asynchronous distributed version of the cluster construction
algorithm pre
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Barbara Keller
Principles of Distributed Computing
Exercise 13
1
Self-stabilizing Spanning Tree
In this exercise, we are searching for ecient, self-stabilizing spanning tree algorithms. Thus, the
spanning
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Laura Peer
Principles of Distributed Computing
Exercise 10: Sample Solution
1
Distributed Network Partitioning
For this exercise, we dene the neighborhood of a node v as Ni (v) := cfw_w V | d(v, w) i.
Inf
Distributed
Computing
FS 2015
Prof. R. Wattenhofer / Michael Knig
o
Principles of Distributed Computing
Exercise 9
1
Scale Free Networks
Dierent studies of the structures of social networks have reported that the degree distribution
of the underlying conn
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Jara Uitto
Principles of Distributed Computing
Exercise 8: Sample Solution
1
Coloring Rings
a) Let n 4 be even, and r = n/2 2. Consider the r-neighborhood graph Nr (Rn ) of the ring
Rn with n nodes. Note
Distributed
Computing
FS 2015
Prof. R. Wattenhofer / Sebastian Brandt
Principles of Distributed Computing
Exercise 6: Sample Solution
1
Concurrent Ivy
a) The three nodes are served in the order v2 , v3 , v1 .
b) Figure 1 depicts the structure of the tree
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Sebastian Brandt
Principles of Distributed Computing
Exercise 6
1
Concurrent Ivy
Consider the tree for the Ivy shared variable protocol in Figure 1. There are three concurrent
requests placed by the nodes
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
David Stolz
Principles of Distributed Computing
Exercise 7: Sample Solution
1
Deterministic Maximal Independent Set
a) Consider the graph consisting of a connected chain of k nodes v1 , . . . , vk . We ad
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Jara Uitto
Principles of Distributed Computing
Exercise 8
1
Coloring Rings
In Chapter 1, we proved that a ring can be colored with 3 colors in log n + O(1) rounds. Clearly,
a ring can only be (legally) co
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
David Stolz
Principles of Distributed Computing
Exercise 7
1
Deterministic Maximal Independent Set
In the lecture, we discussed a slow but simple deterministic maximal independent set (MIS) algorithm (Alg
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Jara Uitto
Principles of Distributed Computing
Exercise 5
1
Shared Sum
In the lecture, we discussed how shared registers can be employed eciently to allow each process
to announce a value to all other pro
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Laura Peer
Principles of Distributed Computing
Exercise 4
1
Sorting Networks
Figure 1: A Sorting Network?
For each of the following questions, prove or disprove the given claim.
Hint: Whenever you need to
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Jara Uitto
Principles of Distributed Computing
Exercise 5: Sample Solution
1
Shared Sum
In the following, let X (initialized to 0) always denote the shared register used to hold the sum
n
x = i=1 xi , and
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Pascal Bissig
Principles of Distributed Computing
Exercise 3
1
Leader Election in an Almost Anonymous Ring
a) Is deterministic leader election possible in a synchronous ring in which all but one processor
Distributed Computing over
Communication Networks:
Topology
(with an excursion to P2P)
Stefan Schmid @ T-Labs, 2011
Some administrative comments.
There will be a Skript for this part
of the lecture. (Same as slides,
except for today. )
Will be online toge
Distributed
Computing
FS 2015
Prof. R. Wattenhofer
Pascal Bissig
Principles of Distributed Computing
Sample Solution to Exercise 2
1
Leader Election in an Almost Anonymous Ring
a) Yes, it is possible:
Algorithm 1 Leader Election (all but one nodes have th