Binary Self - Stabilization
By: Sukumar Ghosh
Presented By: Ilan Cohen
Our Goal:
Show an algorithm for self-stabilization with Only Two States.
Unfortunately:
There is no deterministic Algorithm for
A ring with only two state.
Global criteria for the legitimate states
In each legitimate state, one privilege is present. In each legitimate state, each possible move
would again bring the system to a legitimate state.
Each privilege is present in at least one legitimate state.
For any pair of legitimate states, there exists a sequence of move transferring the system from one to another.
Few Simple Cases:
P1P0P0 : if (s[0],s[1])=(b,¬b) then s[0] := ¬b fi
P1: if (s[0],s[1])=(b,b) then s[1] := ¬b fi
P0 P1
P2
P0 : if (s[0],s[1],s[2])=(b,b,¬b) then s[0]:= ¬b fi
P1: if (s[0],s[1]) = (b,¬b) then s[1] := b fi
P2: if (s[1],s[2]) = (b,b) then s[2] := ¬b fi
P2 P1
P0
P3 P0 : if (s[0],s[1]) = (b,¬b) then s[0]:= ¬b fi
P1: if (s[1],s[2],s[3])=(b,b,¬b) then s[1]:= ¬b fi
P2: if (s[0],s[1],s[2])=(b,b,¬b) then s[2]:= b fi
P3: if (s[2],s[3]) = (b,b) then s[3] := ¬b fi
A general system:
P0
P1
P2
P3
P4
P5
P6
P2n-3
P2n-2
P2n-1
The bottom
machine
The top
machine
The x- machines
The y-
machines
The Algorithm For each x-machine 2i,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,¬b,b) then s[2i]:= b fi For each y-machine 2i-1,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,b,¬b) then s[2i-1]:=¬b fi For the bottom machine 0
If (s[0],s[1]) = (¬b,b) then s[0]:= b fi For the bottom machine 2n-1
If (s[2n-1],s[2n-2]) = (b,b) then s[2n-1]:=¬b fi
Correctness criteria Symobls
pX,pY,pT,pB denote the privileges of the x-machines ,y – machines ,Top and Bottom machine.
For Machine i, (i+2) and (i-2) are right and left neighbor
Precondition →i Post condition will be used to present the changes cause when machine i makes a move.
Lemma 1:No DeadlockLet’s say s[2n-1]=b
If ¬pT holds s[2n-2]= ¬b ,if (¬pX[2i] ¬pY[2i-1])i1..n-1
then (s[2i-1] s[2i-2]) s[1] s[0] pB is true.
P2n-4 P2n-2
P2n-3
P2n-1
P2n-6
P2n-5
¬b
b
¬b1
b1
¬b2
b2
Lemma 2.
No two adjacent machines cansimultaneous privileges
b
b
b
¬b
For each x-machine 2i,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,¬b,b) then s[2i]:= b fi
For each y-machine 2i-1,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,b,¬b) then s[2i-1]:=¬b fi
b
¬b
P2i P2i+2P2i-2
P2i-1P2i-3 P2i+1
Lemma 3. Propagation of pX let s[2i]=b then
1. pX[2i] ((s[2i+2],s[2i+3])=(b,¬b))2i¬pX[2i] pX[2i+2]
2. pX[2i] (s[2i+2]=s[2i+3]) 2i ¬pX[2i] ¬pX[2i+2]
3. pX[2i]((s[2i+2],s[2i+3])=(¬b,b)2i¬pX[2i] pY[2i+1]
b
¬b
For each x-machine 2i,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,¬b,b) then s[2i]:= b fi
For each y-machine 2i-1,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,b,¬b) then s[2i-1]:=¬b fi
P2i P2i+2
P2i+1 P2i+3
¬b
Lemma 4. Propagation of pY let s[2i+1]=b then
1. pY[2i+1]((s[2i-1],s[2i-2])=(b,b))2i+1pY[2i-1] ¬pY[2i+1]
2. pY[2i+1](s[2i-1] s[2i-2])2i+1 ¬pY[2i-1] ¬pY[2i+1]
3. pY[2i+1]((s[2i-1],s[2i-2])=(¬b,¬b))2i+1pX[2i] pY[2i+1]
For each x-machine 2i,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,¬b,b) then s[2i]:= b fi
For each y-machine 2i-1,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,b,¬b) then s[2i-1]:=¬b fi
b b
b
P2i+1P2i-1
P2i-2 P2i
¬b
Lemma 5 (Collision of privileges)Let pX[2i] pY[2i+3] hold, then regardless of the
order in which machines 2i and 2i+3 make their moves, and either pX[2i+2] or pY[2i+1]
P2i P2i+2
P2i+1 P2i+3
Lemma 6 (Reflection of privileges)(a) If pX[2n-2] 2n-2 pT then pT2n-1 pY[2n-3]
(b) If pY[1] 1 pB then pB0 pX[2]
b
b
b
¬b
For each x-machine 2i,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,¬b,b) then s[2i]:= b fi For each y-machine 2i-1,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,b,¬b) then s[2i-1]:=¬b fi
For 0 machine
If (s[0],s[1]) = (¬b,b) then s[0]:=b fi
¬b
P0
P2
P1 P3
¬b
Theorem 7.Within three successive moves by the machine 2i, machine(2i+2) must move at least once.
Let’s notice between two successive moves by machine 2i The states of all three neighbors must change.Let’s divide for three cases according to lemma 3.1. pX[2i] ((s[2i+2],s[2i+3])=(b,¬b))2i¬pX[2i] pX[2i+2]
b
¬b
b
¬b
For each x-machine 2i,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,¬b,b) then s[2i]:= b fi
For each y-machine 2i-1,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,b,¬b) then s[2i-1]:=¬b fi
P2i P2i+2
P2i+1 P2i+3
¬b
Theorem 7. contWithin three successive moves by the machine 2i, machine(2i+2) must move at least once.
2. pX[2i] ((s[2i+2],s[2i+3])=(¬b,¬b))
b
¬b
¬b
¬b
For each x-machine 2i,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,¬b,b) then s[2i]:= b fi
For each y-machine 2i-1,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,b,¬b) then s[2i-1]:=¬b fi
P2i P2i+2
P2i+1 P2i+3
¬b
b b
b
Theorem 8.Within three successive moves by the machine (2i+1), machine (2i-1) must move at least once.
Proof. Starting from Lemma 4, this can be proved exactly in the same way.
b
b
For each x-machine 2i,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,¬b,b) then s[2i]:= b fi
For each y-machine 2i-1,i1..n-1
If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,b,¬b) then s[2i-1]:=¬b fi
P2i-2 P2i
P2i-1 P2i+1
¬b
Theorem 9.In an infinite sequence of moves, every machine must move infinitely often.
Proof. Lemmas 3-6 show that the total number of privileges is nonincreasing.
Theorem 7 establishes the fact after a bounded number (at most two)
of moves by an x-machine it’s privilege is transfer to the right neighbor.
Similarly , it follows from theory 8 that after a bounded number of
moves by an y-machine it’s privilege is transfer to the left neighbor.
According to lemma 6, a pX is converted to a pY when the top machine moves, and pY converted to pX when the bottom machine moves.
Therefore in a infinite sequence of moves, each machine must move infinitely often.
Theorem 10.If exactly one machine of moves has a privilege then the system is stabilized
Proof. Lemmas 3-6 show that the total number of privileges is nonincreasing,
Also following from lemma 1 (no deadlock) , at least one privilege
always exists. It follows from Theorem 9 That in an infinite sequence
of moves every machine move infinitely often.
Thus the one privilege remain the only one and passes from machine
to machine.
Theorem 11.This Algorithm guarantees self-stabilization.
Proof. We need to demonstrate that in a finite number of moves, the number
of privileges is reduced to one.
Lemmas 3-6 show that the total number of privileges is nonincreasing.
Theorem 7 establishes the fact after a bounded number (at most two)
of moves by an x-machine it’s privilege is transfer to the right neighbor.
Similarly , it follows from theory 8 that after a bounded number of
moves by an y-machine it’s privilege is transfer to the left neighbor.
According to lemma 6, a pX is converted to a pY when the top machine moves, and pY converted to pX when the bottom machine moves.
Theorem 11.ContThis Algorithm guarantees self-stabilization.
Under these circumstances, it is inevitable that as long as
more than one privileges , the condition pX[2i] PY[2i+3]
hold for some I According to Lemma 5, this always leads
to the negation of one of the two privileges,
Thus the number of privileges is reduced to 1 and
according to Therefore the system is stabilized.
Example N=8:
0
1
0
1
1
0
0
For each x-machine 2i,i1..n-1If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,¬b,b) then s[2i]:= b fi For each y-machine 2i-1,i1..n-1If (s[2i-2],s[2i-1],s[2i],s[2i+1]) = (b,b,b,¬b) then s[2i-1]:=¬b fi For the bottom machine 0If (s[0],s[1]) = (¬b,b) then s[0]:= b fi For the bottom machine 2n-1If (s[2n-1],s[2n-2]) = (b,b) then s[2n-1]:=¬b fi
P1
P2
P0
P4
P3 P5
P6
P7
1
10
0
0
0
0 0
1
111
1
1 1 1
Remarks In this algorithm every general machine is required to
read the states of three of its neighbor, the required atomicity is therefore large.
This article proved for central demon, because of the property of noninterference (Lemma 2), it is tempting to conclude that the proposed algorithm works with distributed algorithm, however because of the large atomicity this issue if far more complex and needs careful examination.
This Topology appear to be the sparsest topology in which self-stabilization is possible with binary machine and deterministic moves.
References
G.M. Brown , M.G. gouda and C.L. Wu, Token systems that self-stabilize.
J.E. Burns M.G. Gouda and R. Miller , On relaxing interleaving assumption.