Diffusing Comp
Diffusing Comp
After recovery
There is a unique tree There is a unique leader
How?
When j changes P.j to j
Check if all nodes have set their root value to j? Achieved through diffusing computation
Diffusing Computation
Initiation
The node that initiates the diffusing computation sends the diffusing computation message to all its children
Propagation
A node propagates the diffusing computation when it receives it
To propagate, the node sends the diffusion message to all its children A node can check some predicate (condition) during propagation
Diffusing Computation
Completion
A node completes the diffusing computation iff
All its children complete the diffusing computation All its neighbors have received (propagated) that diffusing computation A node can also check some predicate during completion
The results from this condition are propagated towards the root;
The diffusing computation completes when the root completes the diffusing computation
If the condition checked by the root evaluates to true, we say that the diffusing computation completes successfully Else, we say that the diffusing computation fails/completes unsuccessfully
Goal of the diffusing computation is to check if the tree is formed at the initiator node
In other words, check if root value of all nodes is equal to that of the initiator
Issues
Multiple nodes may start diffusing computation
Node with higher ID should win (I.e., its diffusing computation should complete successfully) Node with lower ID should lose.
Use sequence number to distinguish between different diffusing computations initiated by the same node
Init
P.j = j
Phase.j = prop Sn.j = newseq() Res.j = true
(Result = result of the diffusing computation) Currently set to true, to be read only after the diffusing computation completes
Propagation
Root.j = root.(P.j) /\ sn.j sn.(P.j)
If (phase.(P.j) = prop)
Phase.j = prop, res.j = true
Else
Res.j = false // Fail this diffusing computation
Completion
Phase.j = prop /\ k : k Neighbors.j : root.j = root.k /\ sn.j = sn.k /\ k : k Ch.j : phase.j = comp
res.j = k : k Neighbors.j {j} : res.j Phase.j = j If (P.j = j /\ res.j) Init(j) // Initiate a new diffusing computation
Diffusing Computation
Can be performed in the absence of a tree
Tree is formed during diffusing computation
The initiator sends the first diffusion message If node, say j, receives a diffusion from k then
If this is NOT the first diffusion message Send a reply to k If this is the first diffusion message then Send the diffusion to all neighbors Send a reply to k after replies from ALL neighbors is received A condition can be checked based on the replies received
Global State
The global state of a system consists of
One local state for each process
Contains all the messages sent and received upto a point in computation
Note that it is possible that the consistent global state records the send of a message but not receive
It implies that the message is in transit