Presentation is loading. Please wait.

Presentation is loading. Please wait.

Termination Detection

Similar presentations


Presentation on theme: "Termination Detection"— Presentation transcript:

1 Termination Detection
4/24/2017 Termination Detection definition motivation for termination detection main concepts in termination termination announcement termination detection Dijkstra-Scholten termination detection for diffusing comptuations Shavit-Francez generalization wave-based snapshot and weight-throwing-based

2 Definitions terminal state (fixpoint) – no actions enabled
4/24/2017 Definitions terminal state (fixpoint) – no actions enabled terminal state of process – a special local state of a process where no event of the process is applicable deadlock is an example of terminal state termination implicit (message termination) - state that allows the receipt of messages but there are no messages in the channels - no action can be executed but the processes are not aware of termination explicit (process termination) - a terminal state with every process in terminal state and no messages in channels implicit termination is easier to design since the processes do not need to know the algorithm terminated

3 Why Termination Detection
4/24/2017 Why Termination Detection objective - convert message terminating algorithms into process terminating. achieved by adding two additional algorithms. The original algorithm is called basic algorithm. The added algorithms perform two tasks: termination detection – recognize that the basic algorithm is in message terminating state termination announcement – makes all processes go into designated terminating state the added algorithms may exchange messages. They are called control messages

4 4/24/2017 More Definitions event can be internal or external (receipt of message) each basic process is assumed to be in one of two states: active - an action of the process is enabled (able to execute) passive - no process actions are enabled variable statep represents whether process is active or passive the following assumptions about basic algorithms: active process becomes passive only on internal event process always becomes active when a message is received internal events where process becomes passive are the only internal events (we ignore active  active events) diffusing computation (centralized algorithm)- algorithm where only one process is active in every initial state this process is called initiator

5 Termination Announcement
4/24/2017 Termination Announcement To announce termination stop control message is flooded to all processes each process sends stop message to every neighbor messages are sent at most once: on local call to Announce on receiving the first stop the algorithm terminates when it receives stop from every neighbor the algorithm works on directed and undirected networks, requires no identities, leader or topological knowledge what does this algorithm resemble? what happens when multiple nodes call announce simultaneously? the algorithm resembles a wave on tree apparently it works just fine with multiple simultaneous announcements

6 Dijkstra-Scholten Termination Detection
4/24/2017 Dijkstra-Scholten Termination Detection The algorithm works on diffusing computations only, p0 is initiator the algorithm dynamically maintains a computation tree T=(VT,ET) Either T is empty, or T is a directed tree with root p0 VT includes all active processes and all basic messages in transit initiator calls Announce when p0 VT (which implies that T is empty) when process p sends basic message mes it becomes the father of this message when mes is received by q if q is involved in computation (does not have a father) it set p to be its father q has a father it sends message sig back to p each process p maintains variable scp that counts the number of sons every time p sends mes, scp is incremented every time p receives sig it is decremented when scp is 0 and p is passive, it sends sig to its parent

7 Termi-nation detection
4/24/2017 Sp - basic send Rp - basic receive Ip - change from active to passive Ap - arrival of signal

8 Shavit-Francez Generalization to the Decentralized Algorithm
4/24/2017 Shavit-Francez Generalization to the Decentralized Algorithm Dijkstra-Scholten algorithm works only on diffusing computations (one initiator) Shavit-Francez suggested generalization to decentralized algorithms (multiple initiators) in their algorithm each initiator maintains a computation tree similar to Dijkstra- Scholten problem - when the tree on one initiator collapsed the initiator does not know if the computation terminated - there still may be other trees solution - all processes participate in a wave non-initiator process continues the wave initiator process continues the wave only if its tree has collapsed by definition of wave a process decides only when all system processes made at least one move. Thus when one process decides the basic computation terminates. when process decides - it calls Announce

9 Wave-Based Termination
4/24/2017 Wave-Based Termination idea: each process counts number of messages sent/received run a wave, subtract received from sent, if total is 0 and all processes are passive -> detect termination problem: contamination

10 Using Timestamps to Track Messages
4/24/2017 Using Timestamps to Track Messages timestamp each basic message, wave is invalid when timestamp of basic message is greater than timestamp of the wave if wave invalid – start another one

11 Termination Detection Using Snapshots and Weight Throwing
4/24/2017 Termination Detection Using Snapshots and Weight Throwing snapshots when process becomes passive it initiates a snapshot if an active process receives a snapshot message, it ignores it eventually, a snapshot succeeds, if this snapshot does not have messages in transition  detect termination if a snapshot succeeds, does it mean that the basic alg. terminated? weight throwing each active process starts with a certain quantity (weight). The sum of all weights is 1. when a process sends a message it sends part of its weight with it, when message arrives, the process adds the message’s weight to its own when a process becomes passive, it sends its weight to initiator when initiator’s weight is equal to 1, detect termination if a snapshot succeeds, does it mean that the program terminated? no, all processes may be passive, yet there may be a message in transition that will make a process active again


Download ppt "Termination Detection"

Similar presentations


Ads by Google