• Aucun résultat trouvé

Wave Algorithm

N/A
N/A
Protected

Academic year: 2022

Partager "Wave Algorithm"

Copied!
23
0
0

Texte intégral

(1)

Wave Algorithm

(2)

Why waves ?

Basic Bloc : Generic subroutine in the design of distributed algorithms

Examples of use :

- Broadcast, Routing, Communication Protocols

- Leader Election

- Resource Sharing, Mutual Exclusion

- Graph Algorithms for Search, Spanning Trees, etc

- Synchronization

- Wake-up

- Deadlock, Termination Detection

- Reset Protocols

- Resource Allocation

- Distributed Sorting, Ranking, etc.

(3)

Specification

A wave algorithm is a distributed algorithm that satisfies the following requirements:

Termination : Each computation is finite

Decision : Each computation contains at least one decide event

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

(4)

Algorithms

Sequential Design

Token Ring

Depth-First Token Circulation

DFTC over Tree Networks

Parallel Design

Propagation of Information with Feedback

Wave Algorithm for Tree Networks

Another BFS Algorithm

(5)

Token Ring

(6)

Token Ring

Base of Protocol IEEE 802.5

(7)

Token Ring

var !"#$% : port label //Process % is an initiator

upon external initialization do send <&'(> to !"#$%;

done

upon receipt of <tok> from q do decide

done

//Process % is not an initiator

upon receipt of <tok> from q do send <&'(> to !"#$%;

done

Decide

(8)

Token Ring

Sequential

Ring

Central

Number of messages : N

Time : N

Size of messages (overhead) : 0

(9)

Depth-First Token

Circulation

(10)

//Process % is an initiator

upon external initialization do Parent% = ⊤;

Next();

//For any Process %

upon receipt of <tok> from q If Parent% = ⊥

then Parent% = q;

fi

If L% = used% then Decide

else if q ≠ Current% ⋀ q ≠ Parent% then used% = used% {Parent%}

send <&'(> to q;

else Next();

fi fi

var Parent%, Current% : port label ∈ L% ∪ {⊥,⊤}, init ⊥; 


used% : set of port labels, init ∅;

DFTC

Procedure Next()

If ∃ q’ ∈ L% \ (used% {Parent%})

then Current% = q’ ∈ L% \ (used% {Parent%})

used% = used% {Current%}

send <&'(> to Current%; else used% = used% {Parent%}

send <&'(> to Parent%;

(11)

Sequential

Arbitrary topology

Central

Number of messages : 2M

Time : 2M

Size of messages (overhead) : 0 (poss. root’s Id)

DFTC

(12)

DFTC over trees

We are given two distributed algorithms:

One for constructing a tree in a general network

DFTC

3 3

2 1 2

1

r

1

2

2

1

3

3 3

2 1 2

1

r

1

2

2

1

3

a b

c d

l

i

r

j

e

f

g

k

(13)

DFTC over trees

d

c a c b c d e

d r g

f k f

g r

j r

i

l

i

r

a b

c d

l

i

r

j

e

f

g

k

(14)

Sequential

(Spanning) Tree topology

Number of messages : 2N-2

Time : 2N-2

Size of messages (overhead) : 0 (poss. root’s Id)

Direct application : Mutual Exclusion

DFTC over trees

(15)

Propagation of Information with

Feedback

(16)

Synchronous r

//Process % is an initiator

upon external initialization do Parent% = ⊤;

∀ q ∈ L% : send <&'(> to q;

var Parent% : port label ∈ L% ∪ {⊥,⊤}, init ⊥; 


used% : set of port labels, init ∅;

PIF

//For any Process %

upon receipt of <tok> from q used% = used% ∪ {q};

If Parent% = ⊥ then Parent% = q;

∀ q’ ∈ L% \ {q}: send <&'(> to q’;

fi

If used% = L%

then If Parent% = ⊤ then decide;

else send <&'(> to Parent%; fi

fi

(17)

Parallel

Arbitrary Topology

Central

Number of messages : 2M

Time : O(N)

Size of messages (overhead) : 0 (poss. root’s Id)

PIF

(18)

Waves over Trees

(19)

WA over Tree Networks

F G I

K

H A

C

N D

L

J E

B

M

Décide Décide

//Process % is a leaf/Initiator upon external initialization do

Let q ∈ L%;

send <&'(> to q;

//For any Process %

upon receipt of <tok> from q used% = used% ∪ {q};

If ∃ q ∈ Lp : q ∉ used% ⋀ used% ∪ {q} = Lp ⋀ ¬ Sentp then send <&'(> to q;

Sent% = true;

fi

If used% = Lp then Decide;

fi var Sent% : boolean, init false; 


used% : set of port labels, init ∅;

(20)

Parallel

Tree Topology

(Semi-)distributed

Number of messages : N

Time : O(D)

Size of messages (overhead) : 0

WA over Tree Networks

(21)

Another BFS Algorithm

(22)

var Parent% : port label ∈ L% ∪ {⊥}, init ⊥; 


Diff% : array[q ∈ L% ] of {-1,0,1}, init 0;

BFS

//For any Process % ≠ root

loop

If ∀ q ∈ L% : Diff% [q] ≥ 0 then for all q ∈ L% do

Diff% [q] = Diff% [q] - 1;

done

Parent% = q| Diff% [q] = -1;

∀ q ∈ L% : send <INCR> to q;

fi end loop

upon receipt of <INCR> from q Diff% [q] = Diff% [q] + 1;

Parent% = q| Diff% [q] = -1;

r

0

0 0 0

0 0 0

0 0

0 0

00 0

00 0 0 0

0 0 000 0 00 0 00 0

0 00 0

0 00 0

0 0

0 0

0

(23)

Parallel

Arbitrary Topology

(Fully) distributed

Number of messages : left as an exercise

Time : left as an exercise

Size of messages (overhead) : left as an exercise

BFS

Références

Documents relatifs

For attachment of the 3270 EP in Gateway or Standalone configuration across a LAN to a host or host Gateway, you will need to know the following (also, ensure

This chapter deals with using the IBM Operating System/2 Extended Edition Version 1.1 Advanced Program-to-Program Communication (APPC) interface. For the remainder

This document describes the implementation of a Token-Ring Gateway in remote models of the IBM 3174 Subsystem Control Unit and examines some of the performance and

The originating station sends a TEST or XID command LPDU on the local ring with the address of the destination in the destination address field and to the null SAP

the Reservation field (the least significant 3 bits), as well as a token bit (used to differentiate a token from a data/command frame) and a monitor bit (used by the active monitor

If the status changes to Normal and then returns to Soft Error within six minutes, return the removed adapters to the ring (by restarting the application programs they

The 110 Read command is a tri-state signal driven by the System Bus which instructs the Adapter card to drive data onto the data bus during DIO operationsI. I/O

Refaites les calculs dans le cas de Slotted Aloha, où le point optimal de fonctionnement est obtenu pour un taux d’occupation du canal de 36,8%... Un ensemble de machines génèrent