190 likes | 297 Views
Design of Nonmasking Tree Algorithm. Goal: design a tree construction protocol systematically by constructing its invariant and fault-span. Ideal State. Each process j maintains a variable P.j. P.j denotes the parent of j in the tree. Each process also has a unique ID
E N D
Design of Nonmasking Tree Algorithm • Goal: design a tree construction protocol systematically by constructing its invariant and fault-span
Ideal State • Each process j maintains a variable P.j. P.j denotes the parent of j in the tree. • Each process also has a unique ID • In an ideal state the graph imposed by the parent relation forms a tree
Faults • Can fail or repair a process • Goal: Reconstruct the tree with the available processes
Due to faults, we may have • Unrooted trees • Because some node’s parent has failed • Multiple (rooted) trees • For example, when a node is repaired, it may form a tree by itself • Observe that there are no cycles. In other words, in the presence of faults, a cycle is not created. • We may want to preserve this during reconstruction. • I.e., this constraint should be in the fault-span
Predicates for Fault-Span (1) • The graph imposed by the parent relation is a forest
Approach for Reconstruction • Dealing with unrooted trees • Somehow the nodes in unrooted trees should be informed so that they know that they are in an unrooted tree • Approach: Introduce a variable color (col) • Green = node thinks it is in rooted tree • Red = node thinks it is in unrooted tree
Action (1) col.j = green (P.j N.j col.(P.j) = red) col.j = red
Predicate in Invariant • What is it that we would like to have true if this action is executed • (P.j N.j col.(P.j) = red) col.j = red
Predicate in Fault-Span (2) • The graph imposed by the parent relation is a forest • col.j = red (P.j N.j col.(P.j) = red)
Note • Observe that Action (1) is aimed at correcting a predicate in the invariant • Must ensure that during correction, the fault-span constraints are not violated
Predicate in Invariant • (P.j N.j col.(P.j) = red) col.j = red • col.j = green
Action (2) • When should a node set its color to green • Need to ensure that constraints of fault-span are not violated • Need to ensure that constraints of previous predicates in invariant are not violated
Action (2) col.j = red (????) col.j = green Choose ???? so that this action does not affect fault-span predicate/previous predicates in invariant
Merging Multiple Trees • Introduce variable root • root.j denotes the ID of the process that j believes to be the root • If a process finds another process with higher root value, it can choose to switch to it.
Action (2) modified col.j = red (j has no children) col.j = green, P.j = j, root.j = j
Predicate in Invariant (3) • (P.j N.j col.(P.j) = red) col.j = red • col.j = green • root.j = root.k
Action (3) root.j < root.k (????) root.j = root.k, P.j = k
Predicate in Fault-Span • The graph imposed by the parent relation is a forest • col.j = red (P.j N.j col.(P.j) = red) • col.(P.j) = green root.j root.(P.j)
Recovery Action for Process Recovery of node j col.j = red, P.j = j, root.j = j