FING 1-ModelBroadcast

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

The Model & Basic Computations

Chapter 1 and 2

The Model

Broadcast

Spanning Tree Construction

Traversal

Wake-up
Paola Flocchini
Distributed Environment

Multiplicity

Autonomy
clock

memory
1+2 =3

computing capabilities

Interaction
typically by
Paola Flocchini exchange of messages
The Model

Collection of entities that communicate


by exchanging messages

communication
link entity, node, site ...

(processor, process,
message-passing object ….)

Paola Flocchini
Entity x
registers
In memory:
state(x) value(x)

Possible operations:

- local storage and processing

- transmission of messages

- (re)setting the clock

- changing the value of the registers

Paola Flocchini
Entity x

state(x)

Finite set of possible system states


(ex: {idle, computing, waiting, processing ….})

Always defined
At any time an entity is in one of these states

Paola Flocchini
External Events

The behavior of an entity is reactive:


triggered by events

Possible events: clock tick


receiving a message
spontaneous impulse

Paola Flocchini
clock ring

Paola Flocchini
message arrival

Paola Flocchini
spontaneous impulse

Paola Flocchini
The reaction of an entity
depends on the event and on its state

State x Event Action

Paola Flocchini
Actions

Action: sequence of activities, e.g.,


computing
sending message
change state

an action is atomic
the activities cannot be interrupted

an action is terminating
the activities must terminate within finite time

Paola Flocchini
Entity Behavior

Rule
State x Event Action

Behavior B(x) = set of rules of entity x for all


possible events and all possible states
The algorithm
The protocol
DETERMINISTIC
(state, event) --> only ONE action

COMPLETE
( (state, event)  an action)

Paola Flocchini
System Behavior

B = { B(x) : x  E}

A system is SYMMETRIC (or homogeneous)


if all the entities have the same behavior

B(x) = B(y),  x,y  E

Property: Every system can be made symmetric

Paola Flocchini
Very different rules, states ….
Workstation

Workstation

Workstation
Server
Workstation

role =(workstation/server )

sxe If role = workstation


ActionW(s,e)
else
ActionS(s,e)
Paola Flocchini
Communication

Message: finite sequence of bits

Communication Network:

Paola Flocchini
Communication
Point-to-point Model y

x w
No(x) = out-neighbors of entity x
Ni(x) = in-neighbors of entity x
N(x) = No(x)  Ni(x)
z

Graph describing the


COMMUNICATION TOPOLOGY

G = (V, A) V: Entities
A: Arcs defined by N

Paola Flocchini
An entity x can send a message only to its
out-neighbors No(x)

and receive from the in-neighbours Ni(x)

Paola Flocchini
Axioms

Finite Transmission Delays

In absence of faults a message from x to


its out-neighbour y reaches y in finite time

x y

Local orientation

Each entity distinguishes


among its neighbors

Paola Flocchini
Local orientation: more precisely

Each entity distinguishes among its out-neighbors

1
2
3
Send Message to 3

distinct labels
=
(out) port numbers

Paola Flocchini
Local orientation: more precisely

Each entity distinguishes among its in-neighbors

a
2
5
b distinct labels
=
(in) port numbers

When a message arrives, the entity can detect from


which port

Paola Flocchini
Local orientation: more precisely

for an edge (x,y) there are two labels:

x y
a 31

x(x,y) y(x,y)

Topology = labeled graph (G, )


Paola Flocchini
Restrictions of the model: examples

Communication Restrictions

queue

Message Ordering

In absence of failures, msgs transmitted


(FIFO) along the same link arrive in the same
order.

Paola Flocchini
Restrictions of the model: examples

Communication Restrictions

Bidirectional Links
 x, Ni(x) = No(x) =N(x) and
 y  N(x): x(x,y) = x(y,x)

a d
x a d y a d
b b b b b b

c a
c c a
z a
Paola Flocchini
Restrictions of the model: examples

Reliability Restrictions:

1. Guaranteed delivery:
Any message that is sent will be received uncorrupted

2. Partial Reliability:
There will be no failures

3. Total Reliability:
No failures have occurred nor will occur

…..
Paola Flocchini
Restrictions of the model: examples

Topological restriction:

The graph G is strongly connected

…..
Knowledge Restrictions

Knowledge of number of nodes


Knowledge of number of links
Knowledge of diameter ….
…..
Paola Flocchini
Restrictions of the model: examples

Time restriction:

Bounded Communication Delay:


There exists a constant  such that, in absence of failures,
the communication delay of any message on any link is
at most 

Synchronized clocks:
All local clocks are incremented by one unit simultaneously
and interval are constant

…..
Paola Flocchini
Complexity measures - Performance

1. Amount of communication

number of messages exchanged


(finer granularity: number of bits) point of view
of SYSTEM

2. Time

point of view Communication delays are in general


of USER
unpredictable !!!

Ideal time:
1 unit
Paolaof time to transmit 1 message
Flocchini
Example - Broadcast

Assumptions = Restrictions
By definition of problem
Unique Initiator
Total reliability
Simplifying assumptions
Bidirectional links
G is connected
Otherwise unsolvable

Paola Flocchini
Algorithm FLOOD
The idea: If an entity knows something, it sends the
info to its neighbours
One entity is INITIATOR, the others are SLEEPING

INITIATOR
spontaneously
send(I) to N(x)

SLEEPING
receiving(I)
send(I) to N(x)

Paola Flocchini
The idea: If an entity knows something, it sends
it to its neighbours except the sender

INITIATOR
spontaneously
send(I) to N(x)

SLEEPING
receiving(I)
send(I) to N(x) - {sender}

It does not terminate


Paola Flocchini
S = {initiator, sleeping, done}

Algorithm for node x:

INITIATOR
spontaneously
send(I) to N(x)
become(DONE)

SLEEPING
receiving(I)
send(I) to N(x) – {sender}
become(DONE)

Paola Flocchini
Algorithm FLOOD

Algorithm for node x:


INITIATOR
spontaneously
send(I) to N(x)
become(DONE)

SLEEPING
receiving(I)
send(I) to N(x) – {sender}
become(DONE)

DONE

Paola Flocchini
Algorithm FLOOD
Algorithm for node x:

State If INITIATOR
spontaneously
send(I) to N(x)
become(DONE)

If SLEEPING
receiving(I)
send(I) to N(x) – {sender}
become(DONE)

If DONE
do-nothing

Paola Flocchini
Algorithm for node x:

Event
If INITIATOR
spontaneously
send(I) to N(x)
become(DONE)

If SLEEPING
receiving(I)
send(I) to N(x) – {sender}
become(DONE)

If DONE
do-nothing

Paola Flocchini
Algorithm for node x:

If INITIATOR
spontaneously
send(I) to N(x)
become(DONE) Action

If SLEEPING
receiving(I)
send(I) to N(x) – {sender}
become(DONE)

If DONE

do-nothing

Paola Flocchini
Example

Paola Flocchini
Correctness

The Algorithm terminates in finite time

It follows from: G connected and total reliability

Termination
Local Termination: when DONE

Global Termination: when?

Paola Flocchini
Message complexity Worst Case

Worst for all possible initiators


m = number of links and for all possible executions

Messages:  2 on each link

 2m
O(m)
More precisely:

Let s be the initiator


|N(s)| +  (|N(x)|-1)
x s

=  |N(x)| -  1
 |N(x)| = 2m x x s

x
=
Paola Flocchini 2m - (n-1)
Time Complexity - Ideal Time Worst Case

Worst for all possible initiators


and for all possible executions

Time: (ideal time)

Max{d(x,s)}
x
= eccentricity of s O(n)
 Diameter(G)  n-1

Paola Flocchini
Time and Events

External events:
spontaneously
receiving
when (clock)

Actions may generate events

send generates receiving


set-clock generates when

Generated events might not occur (in case of faults).


If they occur, they occur later.

In the case of receiving with some unpredictable delay.

Paola Flocchini
Different delays ---> different executions

Different executions could have different outcomes

(Spontaneous events are considered generated


before execution starts: initial events)

An executions is fully described by the sequence of events


that have occurred

Paola Flocchini
Time x Event diagram

Spontaneous event

receiving event

time
x
as seen by an observer

Paola Flocchini
Example: Time x Event diagram of Flooding

One possible execution

x y

Paola Flocchini
z
Example: Time x Event diagram of Flooding

Another execution

x y

Paola Flocchini
z
Knowledge

P = fact; x = entity; S = set of entities.

• Local knowledge LK
P  LK(x). x P

• Implicit knowledge IK
P  IK(S) if x  S: P  LK(x). S

x P
• Explicit knowledge EK
P  EK(S) if x  S: P  LK(x).

P P S
P P

Paola Flocchini P P
•Common knowledge CK
P  CK(S) if
x  S, P  LK(x) 
x  S (x  S, P  LK(x))  LK(x) 
x  S ((x  S, P  LK(x))  LK(x))  LK(x)  ...

Paola Flocchini
Examples

Implicit knowledge

I am in a ring

Explicit knowledge

I am in a ring
I am in a ring

I am in a ring I am in a ring

Paola Flocchini
Common knowledge

I know I’m in a ring,


everyone knows it,
everyone knows that
everyone knows it, ...
….

Paola Flocchini
How to reach common knowledge in FINITE TIME ?

P  CK(S) if
x  S, P  LK(x) 
x  S (x  S, P  LK(x))  LK(x) 
x  S ((x  S, P  LK(x))  LK(x))  LK(x)  ...

muddy forehead

I can see you


disobeyed
t=1
t=2

t=3

t=4
Paola Flocchini
Paola Flocchini
??

I see one dirty forehead

Paola Flocchini
I see everybody else is clean

I must be dirty !!!!!

Paola Flocchini
t=1

Paola Flocchini
? ?
?
t=1
? ? ?
? ?
? ?
? ? ?

Paola Flocchini
The other didn’t go forward … I must be dirty too !!!!
? ?
t=2
? ? ?
? ?
? ?
? ?

The other didn’t go forward …


I must be dirty too !!!!

Paola Flocchini
t=2

Paola Flocchini
In general ….

If I see k dirty foreheads and they do not go forward all


together at time k, I go forward at time k+1

Paola Flocchini
Some types of knowledge

Topological knowledge
Graph type (“G is a ring”...), adjacency matrix of G ...

Metric knowlege
Number of nodes, diameter, eccentricity...

Sense of direction
Information on link labels
Information on node labels

As the available knowledge grows, the algorithm becomes less


portable (rigid). Generic algorithms do not use any knowledge.

Paola Flocchini
Example: impact of knowledge

In specific topologies flooding can be avoided


and broadcast can be much more efficient
(if the topology is known).

What is the complexity of flooding in a complete graph ?


How can it be done more efficiently ?

What is the complexity of flooding in a tree ?


Can it be done more efficiently ?

Paola Flocchini
Example: The labeled hypercube

1 1 1 1
00 01 0 1

2 2

1 1
2 2 2 100 101
1 1
10 11 2 3 2 3
110 111 2
1 1
3 3

3 3
1 1
2 000 001
3 3 2
2
010 011 2
1 1
Each link between two nodes is labeled
Paola Flocchini by the dimension of the bit
by which the nodes‘ name differ.
1 1
2 100 101
2 3 2 3
110 111 2
1 1
3 3

3 3
1 1
2 000 001
3 3 2
2
010 011 2
1 1

X= xkxk-1 ….. x1x0 x2x1x0

K-bit name first bit

Paola Flocchini
0000 1 1 0001
2
2 34 2 3 4
0010 1 1 0011 2
3 4 3
3 3
1 1 0101
2 0100
3 3 2 4
2
0110 0111 2
1 1
4 4
4
1000 1 1
2 1001
4
2 3 2 3
1010 1 1 1011 2
3 3
4 3 4 3
1 1 1101
2 1100
3 3 2
4 2 4 1111
1110 2
1 1

Paola Flocchini
A hypercube of dimension k has n = 2k nodes

Each node has k links

 m = n k/2 = O(n log n)

Flooding would cost O(n log n)

Paola Flocchini
HyperFlood - Efficient Broadcast

1) The initiator sends the message to all its


neighbours
2) A node receiving the message from link l,
sends it only to links with label l’ < l

Paola Flocchini
Correctness

Every node is touched

Based on the lemma:

For each pair of nodes x and y there exists a


unique path of decreasing labels

X= xk,xk-1 ….. x1,x0

Y= yk,yk-1 ….. y1,y0

Paola Flocchini
Correctness

Every node is touched

Based on the lemma:

For each pair of nodes x and y there exists a


unique path of decreasing labels

X= xk,xk-1 ….. x1,x0 Y= yk,yk-1 ….. y1,y0

Consider positions where they differ in decreasing order …

Paola Flocchini
Example: 5 4
8 x
3 8

X= 100010100 5

Y= 110001000 4

3
x
100010100
y
110010100
100000100
100001100

100001000 y
Paola Flocchini
---> the messages create a spanning tree ….
and every node is touched
1 1
2
2 34 2 3 4
1 1 2
3 4 3
3 3
1 1
2
3 3 2 4
2
2
1 1
4 4
4
1 1
2
4
2 3 2 3
1 1 2
3 3
4 3 4 3
1 1
2
3 3 2
4 2 4
2
1 1

Paola Flocchini
Complexity: n-1 (OPTIMAL)

Because every entity receives the info


only ONCE.

Paola Flocchini
In Special Topologies

General Flooding: 2m - (n-1)

Ad-hoc algorithm in hypercube: (n-1)

Ad-hoc algorithm in complete network: (n-1)

In the tree Flooding is optimal: (n-1)

Paola Flocchini
Important Facts

State x Event ---> Action

(x,t) = internal state of entity x

content of memory (registers, clock, …) at time t

Paola Flocchini
E1, E2: different environments

a
a

1 = 2

E1 E2

1) If the same event happens to x at time t in two different


executions and if the internal states 1 and 2 of x in
the two executions at that time are equal, then
the new internal state of x will be the same in both
executions
Paola Flocchini
a a

x y

(x) = (y)

2) If the same event happens to x and y at time t in the


ame execution and if the internal states (x) and (y)
re equal, then the new internal states of x and y will be
he same.

Paola Flocchini
An example

Back to Broadcast …

Theorem: Under the set of assumptions:


unique Initiator
G is connected
no failures
bidirectional links

Every generic broadcast protocol requires, in the worst


case, m messages.

Paola Flocchini
Lower Bounds for Broadcast

Proof.
m(G) = n. of edges in G

By contradiction.
Let A be an algorithm that broadcasts exchanging
less than m(G) messages (in all executions, and
for any graph G) under those assumption.

Then there is at least a link in G where no messages


are sent.

Paola Flocchini
G=(V,E)
Let e = (x,y) be such a link.
G
y
x

Construct a new graph G’ (remember: n is unknown)

G' =(V {z}, E-e  {(x,z),(y,z)}


G'
y
x

Execute the same algorithm on G’ with the same


time delays, same initial internal states for all
nodes except for z which is sleeping
Paola Flocchini
Two executions in two environments

E1
E2

G G'
y y
x x

For all nodes, except z, the two executions are identical

x and y never send to each other in E1


--->
x and y never send to z in E2
Paola Flocchini
E1
E2

G G'
y y
x x

Within finite time the protocol terminates

but in E2 node z will never be reached.


Paola Flocchini
Observations:

1) Dense networks = more messages


(ex. in complete networks m = n (n-1) …)
2) It is optimum in acyclic graphs

Idea: to solve broadcast.

1. Build a spanning tree of G

2. Execute flooding

Spanning Tree construction Problem


Paola Flocchini

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy