Introduction to Self-Stabilization
Maria Potop-Butucaru, Franck Petit and Sébastien Tixeuil
LiP6/UPMC
Self-stabilization 101 Example
U0=a
Un+1=U2n ifUnis even Un+1=3Un2+1 ifUnis odd
Example
U0=a
Un+1=U2n ifUnis even Un+1=3Un2+1 ifUnis odd
16
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
27
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Iterations
Values
"Correct"
Self-stabilization
Time
Configurations
"Correct"
Time
Configurations
"Correct"
Stabilization Time
Time
Configurations
"Correct"
Stabilization Time Stabilized
Self-stabilization
Arbitrary Legitimate
f1 f2 f1
Self-stabilization Distributed Systems
•
Locality of time•
Locality of information•
Non-determinismDistributed Systems
•
Configuration: product of the local states of system components•
Execution: interleaving of the local executions of the system componentsDistributed Systems
•
Classical: Starting from a particular initial configuration, the system immediately exhibits correct behavior•
Self-stabilizing: Starting from any initial configuration, the system eventually reaches a configuration from which its behavior is correctDistributed Systems
•
Self-stabilizing: Starting from any initial configuration, the system eventually reaches a configuration from which its behavior is correct•
Defined by Dijkstra in 1974•
Advocated by Lamport in 1984 to address fault-tolerant issuesAssumptions
Atomicity
•
A «stabilizing» sequential programSelf-stabilization Hypothesis Composition Proof Techniques Conclusion
Atomicity
I
Example of “stabilizing” sequential program
int x = 0;
...
while( x == x ) { x = 0;
// code assuming x equals 0 }
Atomicity
•
A «stabilizing» sequential programSelf-stabilization Hypothesis Composition Proof Techniques Conclusion
Atomicity
I Example of “stabilizing” sequential program
0 iconst_0 1 istore_1 2 goto 7 5 iconst_0 6 istore_1 7 iload_1 8 iload_1 9 if_icmpeq 5 Problem
Communications
a b
c e
e
Communications
a b
c e
e
Communications
a b
c e
e
Example
•
Shared memory: in one atomic step, read the state of all neighbors and write own state•
Guarded command Guard!ActionPredicate on the states of the neighborhoodExecuted if
Guard is true
Self-Stabilizing Token Ring
p = top
TR1 : (v p =vl) → vp:=vl⊕k1 p ≠ top
TR2 : (v p ≠ vl) → vp:=vl Bottom
Top
Middle Bottom Top Middle
Self-Stabilizing Token in Linear Chain
R0: (Lp≠n) and (Lp≠LF+1) and (LF ≠n) → Lp := LF+1;
R1: (Lp≠n) and (LF=n) → Lp := n;
R2: Let q be a neighbor of p such that:
(Lp=n) and (Lq<n-1) → Lp := Lq+1; F:=q;
r0
10 9
2 4
13 1
11 12
4
7 1
1
5
(n=14)
Self-Stabilizing Spanning Tree Construction
BFS
true!Distancei:=M inj2N eighborsi{Distancej+ 1}
3 3
2 1 2
2
r 1
2 2
1
3
Scheduling
•
Scheduler (a.k.a. Daemon): the daemon chooses among activatable processes those that will execute their actions•
can be seen as an adversary whose role is to prevent stabilizationSpatial Scheduling
true!colori:=M in \ {colorj|j2N eighborsi}
=
a b
d
c e
f
a b
a d
c e
f
a b
Temporal Scheduling
token!pass token to left neighbor with probability 1 token= no token= 2
Composition Schemes
Fair Composition
•
Basic idea•
Compose several self-stabilizing algorithms such that their results can be resused by•
can not detect whether algorithms have stabilized, but behaves as ifA1, A2, . . . , Ak
Ak+1 Ak+1
Example
•
We are given two self-stabilizing algorithms, one for constructing a tree in a general network, one for mutual exclusion on a unidirectional ring3 3
2 1 2
1
r 1
2 2
1
3
3 3
2 1 2
1
r 1
2 2
1
3
a b
c d l
i
r j
e f
g
k
Example
d
c a c b c d e
d r g f k f g r j r i
l
i
r
a b
c d l
i
r j
e f
g
k
Proof Techniques
Transfer function
•
Basic idea•
Used to prove convergence•
Convenient to compute stabilization timeSelf-stabilization Hypothesis Composition Proof Techniques Conclusion
Transfer Function
Basic Idea
I c1!c2!c3!c4!· · ·!ci
I FP(c1)>FP(c2)>FP(c3)>. . .>FP(ci) =bound
I Used to prove convergence
I Can be used to compute the number of steps to reach a legitimate configuration
Transfer Function
Time
Configurations
"Correct"
Stabilization Time Stabilized
Time
Configurations
"Correct"
Stabilization Time Stabilized
Attractors
Arbitrary Attractor Legitimate
d
Attractors
Arbitrary Legitimate
f1 f2 f1
Attractors
Arbitrary Attractor
Legitimate
f f f
f f
f
f f
f f
f f f
f f
f f