Upload
claud-smith
View
215
Download
3
Embed Size (px)
Citation preview
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
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
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
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
Termination Announcement
To announce terminationstop control messageis flooded to all processes
each process sends stop message toevery 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?
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
Termi-nation
detection
Sp - basic sendRp - basic receiveIp - change from active to passiveAp - arrival of signal
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
Termination Detection UsingSnapshots 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