Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 26

Global State Collection

Introduction

In a distributed system, each process executes actions on the basis of local information that consists of its own state, and the states of its neighbors, or messages through the incoming channels. Many applications need to find out the global state of the system by collecting the local states of the component processes like : Computation of the network topology Counting the number of processes in a distributed system Detecting termination Detecting deadlock Detecting loss of coordination

Global State collection

The algorithms for global state collection have been classified into various types:

Probe-echo algorithm, Wave algorithm, Heartbeat algorithm

Wave Algorithms

A wave algorithm is a distributed algorithm that satisfies the following three requirements: Termination: Each computation is finite

Decision: Each computation contains at least one decide event


Dependence: In each computation each decide event is causally preceded by an event in each process

Traversal Algorithms

A traversal algorithm is an algorithm with the following three properties: In each computation there is one initiator, which starts the algorithm by sending out exactly one message. A process, upon receipt of a message, either sends out one message or decides. The algorithm terminates in the initiator and when this happens, each process has sent a message at least once.

Waveform Algorithm

One or more initiators start a computation. The computation in a non-initiator node is triggered by the computation in an adjacent node. Each node reaches local termination when a predefined local goal is reached.

The system-wide computation terminates in a bounded number of steps after it has been initiated.

AN ELEMENTARY ALGORITHM FOR BROADCASTING

Each process i has a stable value s(i) associated with it.


The goal is to devise an algorithm by which every process i can broadcast its value s(i) to every other process in this system. At the end, each process i will have a set V.i = {for all k : 0 k N 1 : s(k)}. Initially V.i = {s(i)}.

Continued..

Every process i will periodically (i) send its current V.i along each of its outgoing channels Receive values along the incoming channels to update V.i. The operation resembles the pumping of blood in the heart, so Heartbeat algorithms!

Two important issues need attention:

The termination of the algorithm The message complexity To save unnecessary work, it makes little sense to send V.i, if it has not changed since the last operation. Furthermore, even if V.i has changed since the last send operation, it suffices to send the incremental change only this will keep the message size small.

program broadcast (for process i}

define V.i, W.i: set of values; initially V.i = {s(i)}, W.i = {and every channel is empty}

1. do V.i W.i send (V.i \ W.i) to every outgoing channel; W.i := V.i
2. empty (k, i) receive X from channel (k, i); V.i := V.i U X

empty(i.k) => W.i V.k.

Induction step. Between two consecutive executions of statement 1, statement 2 must be executed at least once. Assume W.i V.k holds after process i executes the first statement r times, and (i, k) is empty.

We will show that W.i V.k holds after process i executes the first statement (r + 1) times, and (i, k) is empty.

Algorithm broadcast terminates when every process has received the value of s(j) from every process j = i.

Proof. When all guards are false, the condition V.i = W.i holds for each i, and the channels are empty. From Lemma 9.1, empty (i. k)=>W.i V.k. Therefore, V.i V.k. Now consider a directed cycle, If for every pair of processes i and k across a channel (i, k) the condition V.i V.k holds, then for i, j : V.i = V.j.

Continued..

In a strongly connected graph every pair of processes (i, j) are contained in a directed cycle, therefore the condition V.i = V.j must hold for every pair of processes in the system.

Also, since s(i) V.i, and no element is removed from a set, each V must contain all the s-values.

Message Complexity

A process i broadcasts only when V.i changes. Starting from the initial value s(i), V.i can change at most (N 1) times. Also, since each node can have at most (N 1) neighbors, each broadcast may consist of at most N 1 messages.

Thus a typical process can send at most (N 1)2 messages.

TERMINATION DETECTION ALGORITHM

One possible mechanism of distributing the computation to the various processes is as follows: The task is initially assigned to an initiator node. The initiator delegates various parts of this task to its neighbors, which delegate parts of their work to their neighbors, and so on.

As the computation makes progress, these nodes exchange messages among themselves.

States of a node
Active and Passive

A process is active, when it has some enabled guards.


If a process is in a passive state, then it does not necessarily mean that the process will always remain passive a message sent by an active neighbor may wake up the process.

An active process on the other hand eventually switches to a passive state, when it has executed all its local actions.

Active & Passive Processes

Termination of a process

Termination corresponds to the following three criteria: (a) every process is in a passive state (b) all channels are empty (c) the global state of the system satisfies the desired postcondition.

To see why termination detection is important, remember that many computations in distributed systems runs in phases. Each phase of a computation runs over the entire system, and to launch phase (i+1), the initiator has to ascertain that phase i has terminated.

THE DIJKSTRASCHOLTEN ALGORITHM

The computation initiated by a single initiator and spreading over to several other nodes in the network is called a diffusing

Computation.

Termination is reported to the initiator as a single event. There are two kinds of messages in the network: 1. signals propagate along the direction of the Edges.

2. Acknowledgments propagate in the opposite direction.

The initiator is a special node (called the environment node) that has no edge directed toward it.
Every other node is called an internal node, and is reachable from the environment node via the edges of the directed path.

Global State Collection

INV2. (C > 0) (D = 0)

TERMINATION DETECTION ON A UNIDIRECTIONAL RING

The algorithm works on a unidirectional ring that is embedded on the topology of the given network the order of the processes in the ring is used to decide the order in which the token traverses the network. The ring topology has no connection with the sending and receiving of messages by the underlying algorithm so a message can be sent by one process to another as long as a path exists, even if they are not neighbors in the ring. All communication channels are assumed to be FIFO.

Active & Passive Processes

Assume that process 0 is the initiator of termination detection . The initiator initiates the algorithm by sending out a token it traverses the network and eventually returns to the initiator.

A process k accepting the token will not forward it to k1 until it becomes passive.

When the initiator receives the token back, it detects termination.

Limitations

What if the token is with process k, but a process m(n 1 > m > k) that was passive, now becomes active by receiving a message from some process l(k > l > 0)? This could lead to a false detection, since the activation of process m will go unnoticed! To prevent this, refine the scheme by assigning the colors white and black to processes and the token.

Rules: For UNIDIRECTIONAL RING

Initially, all processes are white, and the initiator sends a white token to process (n 1). Rule 1. When a non-initiator process sends a message to a higher numbered process, it turns black. Rule 2. When a black process sends a token, the token turns black. If a white process forwards a token, then it retains the color of the token. Rule 3. When a black process sends a token to its successor, it turns white.

You might also like