I have read his seminal paper, Self-stabilizing systems in spite of distributed control. However, I don't quite get how the self-stabilizing algorithm works. I am most interested in his, 'solution' of k-state machines. The density of the paper is quite intense and I can't make much sense of it. How does this algorithm work in plain English?
-
I wasn't sure-- since it is algorithm related I thought it was suited for here. I checked the FAQ and it said SO was also for algorithm questions. – Jun 22 '11 at 04:57
-
Looks like you're right. Sorry! – Matt Ball Jun 22 '11 at 04:58
-
http://en.wikipedia.org/wiki/Self-stabilization – Jean-François Corbett Jun 22 '11 at 06:19
-
1I have read that-- furthermore, I have read the original paper by Dijkstra. I still don't quite get the k-state solution. – Jun 22 '11 at 06:30
3 Answers
I can try to explain it in plain English...
First you should have a look at the link Jean-Francois Corbett wrote as a comment.
Definition
(from Wikipedia)
A system is self-stabilizing if and only if:
- Starting from any state, it is guaranteed that the system will eventually reach a correct state (convergence).
- Given that the system is in a correct state, it is guaranteed to stay in a correct state, provided that no fault happens (closure).
Notations
Same as the one on the seminar paper
Self Stabilizing system
In his paper Dijkstra defines a self stabilizing system as follow:
Consider a circle graph with N+1 nodes. (From 0 to N+1)
Each node can be in different states.
Each node can have different privilege. (for example xS = xR can be a privilege)
At each step if in one node a privilege is present we will apply a certain rule :
if privilege then "what to do" endif
Legitimate States
He defines a legitimate state to be a state with only one privilege present.
Conclusion
If you apply the different rules in Dijkstra's paper for the described system you will get a self-stabilizing system. (cf definition.)
i.e. from any state with n privilege presents (even with multiple privileges for one node) you will reach in a finite number of states a state with only one privilege present, and stay in legitimate states after this state. And you will be able to reach any legitimate state.
You can try yourself with a simple example.
Example for the 4 states solution
Let's take only a bottom node and a top node:
starting point: (upT,xT) = (0,0) and
(upB,xB) = (1,0)
state1: (upT,xT) = (0,0) and
(upB,xB) = (1,1)
only one privilege present on B => legitimate
state2: (upT,xT) = (0,1) and
(upB,xB) = (1,1)
only one privilege present on T => legitimate
state3: (upT,xT) = (0,1) and
(upB,xB) = (1,0)
only one privilege present on B => legitimate
state4: (upT,xT) = (0,0) and
(upB,xB) = (1,0)
only one privilege present on T => legitimate
and here is a result for 3 nodes: bottom (0) middle (1) top (2): I start with 2 privileges (not legitimate state, then once I get into a legitimate state I stay in it):
{0: [True, False], 1: [False, False], 2: [False, True]}
privilege in bottom
privilege in top
================================
{0: [True, True], 1: [False, False], 2: [False, False]}
first privilege in middle
================================
{0: [True, True], 1: [True, True], 2: [False, False]}
privilege in top
================================
{0: [True, True], 1: [True, True], 2: [False, True]}
second privilege in middle
================================
{0: [True, True], 1: [False, True], 2: [False, True]}
privilege in bottom
================================
{0: [True, False], 1: [False, True], 2: [False, True]}
first privilege in middle
================================
{0: [True, False], 1: [True, False], 2: [False, True]}
privilege in top
================================
{0: [True, False], 1: [True, False], 2: [False, False]}
second privilege in middle
================================
{0: [True, False], 1: [False, False], 2: [False, False]}
privilege in bottom
... etc
Here is a small python code (I am not very good at python so it's may be ugly) to test the 4 states methods with a system of n nodes, it stops when you find all the legitimate states:
from copy import deepcopy
import random
n=int(raw_input("number of elements in the graph:"))-1
L=[]
D={}
D[0]=[True,random.choice([True,False])]
for i in range(1,n):
D[i]=[random.choice([True,False]),random.choice([True,False])]
D[n]=[False,random.choice([True,False])]
L.append(D)
D1=deepcopy(D)
def nextStep(G):
N=len(G)-1
print G
Temp=deepcopy(G)
privilege=0
if G[0][1] == G[1][1] and (not G[1][0]):
Temp[0][1]=(not Temp[0][1])
privilege+=1
print "privilege in bottom"
if G[N][1] != G[N-1][1]:
Temp[N][1]=(not Temp[N][1])
privilege+=1
print "privilege in top"
for i in range(1,N):
if G[i][1] != G[i-1][1]:
Temp[i][1]=(not Temp[i][1])
Temp[i][0]=True
print "first privilege in ", i
privilege+=1
if G[i][1] == G[i+1][1] and G[i][0] and (not G[i+1][0]):
Temp[i][0]=False
print "second privilege in ", i
privilege+=1
print "number of privilege used :", privilege
print '================================'
return Temp
D=nextStep(D)
while(not (D in L) ):
L.append(D)
D=nextStep(D)

- 3,558
- 3
- 32
- 71

- 7,490
- 7
- 46
- 63
-
Thanks, I am working through your examples. I wish Dijkstra had walked through the solutions too. – Jun 23 '11 at 04:11
-
1
Here's a battle tested self-stabilization library (with a very asynchronous design):
https://github.com/hpc/libcircle
More information on how Dijkstra's self-stabilizing ring has been incorporated into this library (work queue splitting techniques) can be found at: http://dl.acm.org/citation.cfm?id=2389114.
The code is also commented fairly well if you don't feel like working through the paper. For example, take a look at: https://github.com/hpc/libcircle/blob/master/libcircle/token.c
Disclaimer: I'm an author of the library and paper.

- 1,340
- 1
- 10
- 21
For Dijkstra's self-stabilizing ring algorithm, you can partition the actions of each non-distinguishable process into closure actions and convergence actions. The action of the distinguished process P0 are closure actions. The convergence actions do not participate into non-progress cycles. As to the closure actions including those of P0, they can only form an infinite loop of a single privilege circulating. If it happens that you have more than one privilege, there is no way that the closure actions keep them circulating. In other words, the number of privileges keep decreasing as they pass through P0: the distinguished process.
The following two publications are particularly interesting, besides Dijkstra's proof in 1986: 1- http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.70.976&rep=rep1&type=pdf 2- http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.27.4320&rep=rep1&type=pdf

- 41
- 1