Download presentation
Presentation is loading. Please wait.
1
The Model & Basic Computations
Paola Flocchini The Model & Basic Computations Chapter 1 and 2 The Model Broadcast Spanning Tree Construction Traversal Wake-up Paola Flocchini
2
Distributed Environment
Paola Flocchini Distributed Environment Multiplicity Autonomy clock memory 1+2 =3 computing capabilities Interaction typically by exchange of messages Paola Flocchini
3
The Model Collection of entities that communicate
Paola Flocchini The Model Collection of entities that communicate by exchanging messages communication link entity, node, site ... (processor, process, object ….) message-passing Paola Flocchini
4
Entity x registers In memory: state(x) value(x) Possible operations:
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
5
Entity x state(x) Finite set of possible system states
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
6
External Events The behavior of an entity is reactive:
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
7
Paola Flocchini clock ring Paola Flocchini
8
Paola Flocchini message arrival Paola Flocchini
9
Paola Flocchini spontaneous impulse Paola Flocchini
10
The reaction of an entity depends on the event and on its state
Paola Flocchini The reaction of an entity depends on the event and on its state State x Event Action Paola Flocchini
11
Actions Action: sequence of activities, e.g., computing
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
12
Entity Behavior Rule State x Event Action
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
13
System Behavior B = { B(x) : x E}
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
14
role =(workstation/server )
Paola Flocchini Workstation Very different rules, states …. Workstation Workstation Server Workstation If role = workstation ActionW(s,e) else ActionS(s,e) s x e role =(workstation/server ) Paola Flocchini
15
Communication Message: finite sequence of bits Communication Network:
Paola Flocchini Communication Message: finite sequence of bits Communication Network: Paola Flocchini
16
Communication Point-to-point Model No(x) = out-neighbors of entity x
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
17
An entity x can send a message only to its out-neighbors No(x)
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
18
Axioms Finite Transmission Delays
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
19
Local orientation: more precisely
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
20
Local orientation: more precisely
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
21
Local orientation: more precisely
Paola Flocchini Local orientation: more precisely for an edge (x,y) there are two labels: y x a 31 x(x,y) y(x,y) Topology = labeled graph (G, ) Paola Flocchini
22
Restrictions of the model: examples
Paola Flocchini Restrictions of the model: examples Communication Restrictions queue Message Ordering In absence of failures, msgs transmitted along the same link arrive in the same order. (FIFO) Paola Flocchini
23
Restrictions of the model: examples
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) d a x y a c b d d a b b b b c a c z a Paola Flocchini
24
Restrictions of the model: examples
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
25
Restrictions of the model: examples
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
26
Restrictions of the model: examples
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
27
Complexity measures - Performance
Paola Flocchini Complexity measures - Performance 1. Amount of communication point of view of SYSTEM number of messages exchanged (finer granularity: number of bits) 2. Time point of view of USER Communication delays are in general unpredictable !!! Ideal time: 1 unit of time to transmit 1 message Paola Flocchini
28
Assumptions = Restrictions
Paola Flocchini Example - Broadcast Assumptions = Restrictions Unique Initiator Total reliability Bidirectional links G is connected By definition of problem Simplifying assumptions Otherwise unsolvable Paola Flocchini
29
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
30
The idea: If an entity knows something, it sends
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
31
S = {initiator, sleeping, done}
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
32
Algorithm FLOOD Algorithm for node x: INITIATOR spontaneously
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
33
Algorithm FLOOD Algorithm for node x: State If INITIATOR spontaneously
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
34
Algorithm for node x: Event If INITIATOR spontaneously send(I) to N(x)
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
35
Algorithm for node x: Action If INITIATOR spontaneously
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
36
Paola Flocchini Example Paola Flocchini
37
Correctness Termination The Algorithm terminates in finite time
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
38
Message complexity Worst Case |N(x)| = 2m m = number of links
Paola Flocchini Message complexity Worst Case Worst for all possible initiators and for all possible executions m = number of links 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 x x s |N(x)| = 2m x = 2m - (n-1) Paola Flocchini
39
Time Complexity - Ideal Time Worst Case
Paola Flocchini Time Complexity - Ideal Time Worst Case Worst for all possible initiators and for all possible executions Time: (ideal time) Max{d(x,s)} = eccentricity of s O(n) x Diameter(G) n-1 Paola Flocchini
40
Time and Events External events: spontaneously receiving when (clock)
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
41
Different delays ---> different executions
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
42
Time x Event diagram Spontaneous event receiving event x y time
Paola Flocchini Time x Event diagram Spontaneous event receiving event time x as seen by an observer y Paola Flocchini
43
Example: Time x Event diagram of Flooding
Paola Flocchini Example: Time x Event diagram of Flooding One possible execution x y z x y Paola Flocchini z
44
Example: Time x Event diagram of Flooding
Paola Flocchini Example: Time x Event diagram of Flooding Another execution x y z x y Paola Flocchini z
45
Knowledge P = fact; x = entity; S = set of entities.
Paola Flocchini Knowledge P = fact; x = entity; S = set of entities. Local knowledge LK P LK(x). Implicit knowledge IK P IK(S) if x S: P LK(x). Explicit knowledge EK P EK(S) if x S: P LK(x). x P S x P P P S P P P P Paola Flocchini
46
x S (x S, P LK(x)) LK(x)
Paola Flocchini 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
47
Examples Implicit knowledge Explicit knowledge I am in a ring
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
48
Common knowledge I know I’m in a ring, everyone knows it,
Paola Flocchini Common knowledge I know I’m in a ring, everyone knows it, everyone knows that everyone knows it, ... …. Paola Flocchini
49
muddy forehead t=1 t=2 t=3 t=4
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
50
Paola Flocchini Paola Flocchini
51
I see one dirty forehead
Paola Flocchini ?? I see one dirty forehead Paola Flocchini
52
I see everybody else is clean
Paola Flocchini I see everybody else is clean I must be dirty !!!!! Paola Flocchini
53
Paola Flocchini t=1 Paola Flocchini
54
Paola Flocchini ? t=1 Paola Flocchini
55
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
56
Paola Flocchini t=2 Paola Flocchini
57
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
58
Some types of knowledge
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
59
Example: impact of 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
60
Example: The labeled hypercube
Paola Flocchini Example: The labeled hypercube 01 00 1 11 10 2 1 010 011 101 000 001 111 110 100 1 3 2 Each link between two nodes is labeled by the dimension of the bit by which the nodes‘ name differ. Paola Flocchini
61
x2x1x0 X= xkxk-1 ….. x1x0 first bit K-bit name 010 011 101 000 001 111
Paola Flocchini 010 011 101 000 001 111 110 100 1 3 2 x2x1x0 X= xkxk-1 ….. x1x0 K-bit name first bit Paola Flocchini
62
Paola Flocchini 1 3 2 0000 0001 4 4 0010 0011 4 0100 0101 4 0110 0111 4 4 4 1 1 2 1000 1001 4 2 3 2 3 1010 1 1 1011 2 3 3 4 3 4 3 1 1 2 1100 1101 3 3 2 4 2 4 1111 2 1110 1 1 Paola Flocchini
63
A hypercube of dimension k has n = 2k nodes Each node has k links
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
64
HyperFlood - Efficient Broadcast
Paola Flocchini HyperFlood - Efficient Broadcast 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
65
For each pair of nodes x and y there exists a
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 yk,yk-1 ….. y1,y0 Y= Paola Flocchini
66
For each pair of nodes x and y there exists a
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 yk,yk-1 ….. y1,y0 Y= Consider positions where they differ in decreasing order … Paola Flocchini
67
Paola Flocchini Example: 5 8 4 x 3 8 X= 5 Y= 4 3 x y y Paola Flocchini
68
---> the messages create a spanning tree ….
Paola Flocchini ---> the messages create a spanning tree …. and every node is touched 1 1 2 4 4 2 3 2 3 2 1 1 3 3 4 3 3 1 1 2 3 3 2 4 2 2 1 1 4 4 4 1 1 2 4 2 3 2 3 2 1 1 3 3 3 4 4 3 1 1 2 3 3 2 4 2 4 2 1 1 Paola Flocchini
69
Complexity: n-1 (OPTIMAL) Because every entity receives the info
Paola Flocchini Complexity: n-1 (OPTIMAL) Because every entity receives the info only ONCE. Paola Flocchini
70
General Flooding: 2m - (n-1)
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
71
State x Event ---> Action
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
72
If the same event happens to x at time t in two different
Paola Flocchini E1, E2: different environments a a 1 = 2 E1 E2 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
73
2) If the same event happens to x and y at time t in the
Paola Flocchini a a x y (x) = (y) 2) If the same event happens to x and y at time t in the same execution and if the internal states (x) and (y) are equal, then the new internal states of x and y will be the same. Paola Flocchini
74
Theorem: Under the set of assumptions:
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
75
Lower Bounds for Broadcast
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
76
Let e = (x,y) be such a link. G
Paola Flocchini G=(V,E) Let e = (x,y) be such a link. G y x y x G' Construct a new graph G’ z G' =(V {z}, E-e {(x,z),(y,z)} (remember: n is unknown) 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
77
Two executions in two environments
Paola Flocchini Two executions in two environments E1 E2 G G' y y x x z 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
78
Within finite time the protocol terminates
Paola Flocchini E1 E2 G G' y y x x z Within finite time the protocol terminates but in E2 node z will never be reached. Paola Flocchini
79
1) Dense networks = more messages
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.