Presentation is loading. Please wait.

Presentation is loading. Please wait.

Termination Detection Presented by: Yonni Edelist.

Similar presentations


Presentation on theme: "Termination Detection Presented by: Yonni Edelist."— Presentation transcript:

1 Termination Detection Presented by: Yonni Edelist

2 The model A finite graph of machines (nodes) and communication channels (edges), in which a distributed computation is taking place Machines can be either ‘active’ or ‘passive’ Only active machines may send messages Passive machine may become active only when it receives a message Active machine may become passive at any time

3 The model- example 02 4 6 3 1 5

4 The problem If, in the computation, a finite number of messages are sent, the graph will reach a stable state in which no more messages are sent One machine, say machine no. 0, wants to detect that the graph has reached that state We will build an algorithm which enables machine 0 to detect termination

5 example We denote messages sent by the termination detection algorithm ‘signals’ 02 4 6 3 1 5

6 Termination detection in a ring

7 The model N machines, 0..N-1 Machine 0 initiates the detection algorithm Does so by sending a signal (a token) to machine 1 Machine i can propagate the token to machine i+1 We denote the machine currently holding the token ‘t’

8 System Invariant We describe an invariant, which will be true for every configuration of the system (for every value of t) Machine 0 will know that all other machines are passive based on: – t=0 – The invariant – (possibly) further information available at machine 0

9 First Invariant- P0 First step- we assume that there are no messages Meaning: an active node may become passive, but not vice-versa P0: ( ∀ i: 0≤i<t machine i is passive)

10 P0- Example 3 2 0 1 Red outline represents an active machine

11 Rule 0 In order to preserve the invariant, we must follow the rule: Rule 0: Machine i transmits the token only if it’s passive (remember that a passive machine can’t become active again)

12 Rule 0- Example 3 2 0 1

13 But what if a message is sent? 3 2 0 1

14 Invariant P1 If machine i<t receives a message, it becomes active, thus falsifying P0 Message must have been sent by machine j≥t P1 is established whenever P0 is falsified in the above manner P0: ( ∀ i: 0≤i<t machine i is passive)

15 Invariant P1 (cont.) A machine can be either black or white P1: ( ∃ j: t ≤ j ≤ N: machine j is black) Rule 1: When machine j sends a message to machine i<j, it becomes black

16 Rule 1- Example 3 2 0 1

17 Invariant P1 (cont.) Now P= P0 ∨ P1 is not falsified when a message is sent to i < j. Machine 0 knows: - (t=0 ∧ machine 0 is white)  ¬P1 - P0: ( ∀ i: 0≤i<t machine i is passive) Therefore- machine 0 can still detect termination

18 But… 3 2 0 1

19 Invariant P2 P1 may be falsified when a black machine hands the token over We want to ensure that every token propagation that falsifies P1 establishes P2 We define that the token may be either black or white

20 Invariant P2 (cont) P2: the token is black And the accompanying rule: Rule 2: A black machine transmits a black token. A white machine doesn’t change the colour of the token

21 Invariant P2 (cont) Machine 0 knows: - (t=0 ∧ machine 0 is white)  ¬P1 -Token is white  ¬P2 - P0: ( ∀ i: 0≤i<t machine i is passive) Therefore- machine 0 can still detect termination

22 Invariant P2- Example 3 2 0 1

23 Rule 3 The algorithm may finish unsuccessfully Rule 3: after an unsuccessful round, machine 0 initiates another round

24 But… 3 2 0 1

25 Rule 4 Since a round that begun with a black token is doomed, we adopt: Rule 4: at the beginning of a new round, machine 0 makes itself white and transmits a white token

26 Still not good enough 3 2 0 1

27 Rule 5 Whitening a black machine i may falsify only P1, and only in the case i > t Rule 5: when transmitting the token to machine i+1, machine i makes itself white P1: ( ∃ j: t ≤ j ≤ N: machine j is black)

28 Final example 3 2 0 1


Download ppt "Termination Detection Presented by: Yonni Edelist."

Similar presentations


Ads by Google