Distributed Algorithms

Table of Contents

Election algorithms

Often leader process needed to coordinate distributed task. In election algorithm, each computation terminates in configuration where one process is leader.

Assumptions:

Chang-Roberts algorithm

directed ring

Initially only initiators active, send message with their ID

Let active process p receive message q

Passive processes pass on messages.

Complexity:

Franklin’s algorithm

Undirected ring.

Each active process p repeatedly compares own ID with IDs of nearest active neighbors on both sides.

If such a neighbor has larger ID, then p becomes passive.

Initially, initiators are active, noninitiators passive.

Each round, active process p

Complexity:

Dolev-Klawe-Rodeh algorithm

Directed ring. Comparison of IDs of active process p and its nearest active neighbors q and r is performed at r.

The process that originally had ID p becomes the leader.

Since message can overtake another message from earlier round, processes maintain round numbers and attach these to their messages.

Complexity:

Tree election algorithm for acyclic networks

Start with wake-up phase, driven by initiators

Election phase (local at process p):

Complexity:

Echo algorithm with extinction

Each initiator starts a wave, tagged with its ID

Noninitiators join the first wave that hits them.

At any time, each process takes part in at m ost one wave.

When process p in wave q is hit by wave r:

If wave p executes a decide event at p, then p becomes the leader.

Complexity:

Minimum spanning trees

Undirected weighted network.

Assume different edges have different weights.

In minimum spanning tree, sum of weights of edges in spanning tree is minimal.

Fragments

Let F be a fragment, i.e. a connected subgraph of minimum spanning tree M.

Let e be lowest-weight outgoing edge of F. Then e is in M.

Kruskal’s algorithm

Uniprocessor algorithm for computing minimum spanning trees.

Also works when edges have same weight, though then minimum spanning tree may not be unique.

Gallager-Humblet-Spira algorithm

Undirected weighted network in which different edges have different weights.

Distributed computation of min spanning tree:

Complexity:

Level, name, core edge

Each fragment carries unique name fn and level l.

Its level is maximum number of joins any process in fragment has experienced.

Neighboring fragments F(fn, l) and F’ = (fn’, l’) can be joined:

Core edge of fragment is last edge that connected two sub-fragments at same level, its end points are core nodes. Name is the weight.

Parameters of process

Its state:

Status of its channels:

Name and level of its fragment.

Its parent toward the core edge.

Initialization

Noninitiators wake up when they receive a connect or test message.

Each initiator, and noninitiator after it has woken up

Joining two fragments

Let fragments F = (fn, l) and F’ = (fn’, l’) be joined via channel pq

At reception of (initiate, fn, l, find/found), a process stores fn and l, sets its state to find or found, an adopts sender as its parent

Computing lowest-weight outgoing edge

In case of (initiate, fn, l, find), p checks in increasing order of weight one of its basic edges pq is outgoing, by sending (test, fn, l) to q.

While l > level(q), q postpones processing incoming test message.

Let l ≤ level(q)

When basic edge accepted, or there are no basic edges left, p stops the search and sets its state to found.

Reporting to core nodes

Termination or changeroot at core nodes

Core nodes receive reports through all their branch edges, including core edge.

Ultimately changeroot reaches the process p that reported the lowest-weight outgoing basic edge.

p sets this channel to branch, and sends (connect, level(p)) into it

Starting join of two fragments

If q receives (connect, level(p)) from p, then level(q) ≥ level(p)

Namely, either level(p) = 0, or q earlier sent accept to p.

For election

By two extra messages at very end, core node with largest ID becomes leader.

So this induces an election algorithm for general undirected networks. We must impose an order on channels of equal weight.