Presentation is loading. Please wait.

Presentation is loading. Please wait.

By J. Burns and J. Pachl Based on a presentation by Irina Shapira and Julia Mosin Uniform Self-Stabilization 1 P0P0 P1P1 P2P2 P3P3 P4P4 P5P5.

Similar presentations


Presentation on theme: "By J. Burns and J. Pachl Based on a presentation by Irina Shapira and Julia Mosin Uniform Self-Stabilization 1 P0P0 P1P1 P2P2 P3P3 P4P4 P5P5."— Presentation transcript:

1 by J. Burns and J. Pachl Based on a presentation by Irina Shapira and Julia Mosin Uniform Self-Stabilization 1 P0P0 P1P1 P2P2 P3P3 P4P4 P5P5

2 Self-Stabilizing System: S = (G, R, ,  ) G = (V,E), |V|=n  =  0 x  1 x... x  n-1 - set of configurations where  i is a finite set of states of processor P i R - orientation of G specifies a total ordering on the neighbors for each v in V  =  0,  1,...,  n-1 - sequence of transition relations  i is the transition relation of P i : from  i x  v1 x... x  vk to  i ( R(i) = (v 1,..., v k ) ) 2

3 For configuration  = (s 0, s 1, …, s n-1 )   where s j is a state of P j (for all j). Self-Stabilizing System: S = (G, R, ,  ) x - possible next state of P i by  i, i.e. if R(i) = (v 1,..., v k ) then x   i (s i, s v1, …, s vk ). Define  i (  ) as the set of configurations  ’ (of all processors) such that  ’ = (s 0,s 1, …, s i-1, x, s i+1, …, s n-1 ) (for all possible values of x) 3 In words:  i (  ) is the set of configurations of the whole system if P i takes a step in .

4 P i is enabled (privileged) at  if  i (  ) is not empty i  ->  ’ is a step of P i if  ’   i (  )  ->  ’ is a step of P i for some i  0,  1,... is a computation of the system where  j-1 ->  j for all j Only one processor takes a step at a time - central daemon Self-Stabilizing System: S = (G, R, ,  ) 4

5 P0P0 A system S = (G, R, ,  ) where An n-processor uniform ring G is a cycle processors are denoted by 0,1, …, n-1 clockwise R(i) = ( (i-1) mod n, (i+1) mod n )  0 =  1 =... =  n-1  0 =  1 =... =  n-1 P1P1 P2P2 P3P3 P4P4 P5P5 5

6 Definition: A system S = (G, R, ,  ) is self-stabilizing iff there is a set , called the legitimate configurations of S, satisfying: For every    there is a  ’   such that  ’ (1) No Deadlock For every   , every ’ such that  ’  is in  (2) Closure Every infinite computation of S contains a configuration in  (3) No Livelock For every   , exactly one processor is enabled (4) Mutual Exclusion For every processor P i, every infinite computation consisting of configurations in  contains an infinite number of steps by P i (5) Fairness 6 2,4 and 5 deal only with legitimate states. The problem is 1 and 3.

7 s0s0 s2s2 Theorem: There is no uniform n-processor self-stabilizing ring if n is composite. Proof: P0P0 P1P1 P2P2 P3P3 P4P4 P5P5 [i] = {P j | j = i mod p} Sym(  )  all the P j in [i] are in the same state in  if Sym(  0 ) holds, we can construct an infinite computation  0 ->  1 ->  2 -> … for which Sym(  i ) holds for every i 0:0: s0s0 s0s0 s0s0 s0s0 s0s0 1:1: s1s1 s1s1 s1s1 s2s2 s2s2 2:2: 7

8 Main Result uniform ( no distinguished processor) O( n 2 ) states deterministic algorithm central scheduler Algorithm for a ring of a prime size: unidirectional 8

9 deterministic unidirectional (the value of  i (s i, s i-1, s i+1 ) depends only on s i and s i-1 ) Notation: means that The algorithm 9

10 A First Attempt  0 =  1 =... =  n-1 = { 0, 1, …, n-2 } arithmetic modulo n-1 The rule: if s i  s i- 1 +1 then s i- 1 s i  s i- 1 +1 10

11 1 21 P0P0 P2P2 P3P3 P4P4 P1P1 0 0 2 3 0 0 1 2 3 1 P1P1 P2P2 0 1 1 2 3 P 0 P 1 P 2 P 3 P 4 0 1 2 2 3 P2P2 P3P3 0 1 2 3 3 3 P3P3 P4P4 0 1 2 3 0 P4P4 0 P0P0... 0 0 1 2 3 P0P0 P1P1 2 3 0 The cycle of the intended legitimate configurations The rule: if s i  s i- 1 +1 then s i- 1 s i  s i- 1 +1 11

12 1321 0210 202 0310 101 P2P2 P3P3 P4P4 0 1 2 0 1 P 0 P 1 P 2 P 3 P 4... 0 1 2 0 1 A configuration sequence which does not converge to the legitimate configurations P1P1 P0P0 P3P3 0 1 2 3 1 P3P3 P0P0 P4P4 2 1 2 3 1 P0P0 P1P1 P4P4 2 1 2 3 0 P4P4 P0P0 P1P1 2 3 2 3 0 P0P0 P1P1 P2P2 1 3 2 3 0 P0P0 P1P1 P2P2 1 3 0 3 0 P1P1 P2P2 P3P3 1 2 0 3 0 P1P1 P2P2 P3P3 1 2 0 1 0 P2P2 P3P3 P4P4 0 1 2 0 1 P0P0 P2P2 P3P3 P4P4 livelock The rule: if s i  s i- 1 +1 then s i- 1 s i  s i- 1 +1 12

13 13

14 The Algorithm: n  3 Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 14 states are label.tag (L i.T i ) labels  { 0, 1, …, n-2 } tags  { 0 } U { 2, 3, …, n-2 }

15 The Proof of Self-Stabilization: Let  be the set of all cyclic permutations of configurations of the form 0.0 1.0 … a-1.0 a.0 a.0 a+1.0 … n-2.0 for a=0, 1, …, n-2 Theorem: If n is prime, then the ring is self-stabilizing (and  is a set of legitimate configurations) S = (G, R, ,  ) Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 15 From now till the end: proof of the theorem.

16 Definitions: Let  be a configuration if L i+ 1  L i +1 (mod n-1), then P i and P i+ 1 form a gap of  the gap size (of P i and  ) g(i,  L i+ 1 - L i (mod n-1) a segment of  is a maximal cyclically contiguous sequence s=(P i, P i+ 1, …, P j- 1, P j ) which contains no gaps the gap size of s g(s,  is the gap size of its right end, g(j,  ) P i is the left end of s, P j is the right end of s a segment is zero based if its left end is 0 (L i = 0) 16

17 Example: P 0 P 1 P 2 P 3 P 4 P 5 P 6 1.3 2.3 3.1 5.2 0.2 1.1 0.4 label.tag n=7 labels  {0, 1, …, 5}, arithmetic mod 6 segment s 1 = (p 3, p 4, p 5 ) segment s 2 = (p 6, p 0, p 1, p 2 ) (p 6, p 0, p 1, p 2 ) is zero based g(s 1,  = 5 g(s 2,  = 2 17

18 The Protocol - Revised: Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 18 Within segment ‘stopped’ by label 0 and by equal tags Between segments There are less distinct labels than processes, so a segment always exists

19 3.03.31.30.21.0 2.0 3.3 2.3 1.0 2.0 3.3 2.3 3.0 P 0 P 1 P 2 P 3 P 4 P1P1 P0P0 P3P3 P2P2 0.2 2.0 3.3 2.3 3.0 P4P4 Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 0.2 P0P0 P1P1 0.2 1.2 3.3 2.3 3.0 1.2 P1P1 P4P4 0.2 1.2 3.3 2.3 3.3 P4P4 P3P3 0.2 1.2 3.3 0.3 3.3 0.3 P3P3 P4P4 0.2 1.2 3.3 0.3 1.3 P4P4 P2P2 0.2 1.2 2.2 0.3 1.3 2.2 P2P2 P3P3 0.2 1.2 2.2 3.2 1.3 3.2 P3P3 P4P4 0.2 1.2 2.2 3.2 0.2 P4P4 P0P0 1.0 1.2 2.2 3.2 0.2 1.0 P1P1 1.0 2.0 2.2 3.2 0.2 P1P1 2.0 P2P2 1.0 2.0 3.0 3.2 0.2 P2P2 3.0 P3P3 1.0 2.0 3.0 0.0 0.2 0.0 P3P3 P4P4 1.0 2.0 3.0 0.0 1.0 P4P4 P0P0 P0P0 19

20 (2) Closure Recall: For every    there is a   ‘  such that  ’ (1) No Deadlock For every   , every ’ such that  ’  is in  Every infinite computation of S contains a configuration in  (3) No Livelock For every   , exactly one processor is enabled (4) Mutual Exclusion For every processor P i, every infinite computation consisting of configurations in  contains an infinite number of steps by P i (5) Fairness Only  A system S = (G, R, ,  ) is self-stabilizing iff there is a set , called the legitimate configurations of S, satisfying: 20

21 For every   , exactly one processor is enabled (4) Mutual Exclusion Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1  is a cyclic permutation of the form = 0.0 1.0 … a-1.0 a.0 a.0 a+1.0 … n-2.0 T i-1 = T i for all i, hence rule B cannot be applied Rule A can be applied to exactly one processor 21

22 For every   , every ’ such that  ’  is in  (2) Closure Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1  is a cyclic permutations of the form = 0.0 1.0 … a-1.0 a.0 a.0 a+1.0 … n-2.0 T i-1 = T i for all i, hence rule B cannot be applied Rule A can be applied to exactly one processor  ’  by rule A ’ = 0.0 1.0 … a-1.0 a.0 a+1.0 a+1.0 … n-2.0  ’  as before 22

23 For every processor P i, every infinite computation consisting of configurations in  contains an infinite number of steps by P i (5) Fairness Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 if P i is enabled in , then P i+1 will be enabled in ’ and so on …  is a cyclic permutations of the form = 0.0 1.0 … a-1.0 a.0 a.0 a+1.0 … n-2.0  ’  by rule A ’ = 0.0 1.0 … a-1.0 a.0 a+1.0 a+1.0 … n-2.0 as before arithmetic (of processors) is mod n 23

24 So, we have to prove: For every    there is a   ‘  such that  ’ (1) No Deadlock For every   , every ’ such that  ’  is in  (2) Closure Every infinite computation of S contains a configuration in  (3) No Livelock For every   , exactly one processor is enabled (4) Mutual Exclusion For every processor P i, every infinite computation consisting of configurations in  contains an infinite number of steps by P i (5) Fairness A system S = (G, R, ,  ) is self-stabilizing iff there is a set , called the legitimate configurations of S, satisfying: 24

25 Rule A doesn’t apply, so all the segments are zero-based Case 1: one zero-based segment of length n if T i-1 = 0 rule A applies else T i-1  0, so T i-1  L i - L i-1 and again rule A applies … L i-1.T i-1 0.T i. … … 0.T i-1 0.T i... Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 25 Assume towards contradiction no rule applies For every    there is a   ‘  such that  ’ (1) No Deadlock

26 Case 2: there is more than one segment 0.t 1 1.t 1 … m 1.t 1 0.t 2 1.t 2 … m 2.t 2 0.t k 1.t k … m k.t k... all the gaps and all the segments have the same size Since n is prime, all the segment lengths must be 1 0.0... 0.0 and rule A applies for each gap! Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 Rule B doesn’t apply: all tags within each segment are equal Rule A doesn’t apply for the base of segment j+1, so t j = 0-m j (for all j) Rule A doesn’t apply: t j  t j+1 for each gap 26 Rule A doesn’t apply, so all the segments are zero-based Hence: No Deadlock holds

27 So, it remains to show: : For every    there is a   ‘  such that  ’ (1) No Deadlock For every   , every ’ such that  ’  is in  (2) Closure Every infinite computation of S contains a configuration in  (3) No Livelock For every   , exactly one processor is enabled (4) Mutual Exclusion For every processor P i, every infinite computation consisting of configurations in  contains an infinite number of steps by P i (5) Fairness A system S = (G, R, ,  ) is self-stabilizing iff there is a set , called the legitimate configurations of S, satisfying: 27

28 Lemma: Proof: The number of segments in a computation is non-increasing. Rule B does not change the number of segments Rule A cannot increase the number of segments PiPi … P i-1 P i … P i-1 P i P i+1 … P i+1 … … P i-1 P i+1 … … P i-1 P i Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 28

29 Lemma: Proof: In every infinite computation, every processor takes a step by Rule A infinitely many times suppose each P i takes a finite number of steps by Rule A if some P i takes an infinite number of steps by rule A, so do all: L i-1 must change between two Rule A steps of P i so P i-1 takes infinitely many Rule A steps, and so does P i-2 … all labels are fixed and so are all segments A left end of a segment cannot take a step by rule B P i which is not a left end can take at most one step more than P i-1... P i- 1 P i … Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 29 only Rule A step by P i can change L i the computation is finite – a contradiction

30 Definition: A computation in which the number of segments is constant is called quiet. Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 30 Next, we want to prove that the number of segments is strictly decreasing. We prove each quiet computation with more than one segment is finite. The number of segments cannot increase. After a finite number of steps we reach a configuration, from which the computation is quiet.

31 Definition : Let C =  0  1 … be a quiet computation a dynamic gap is a function z from indices of computation into indices of processors, satisfying the following: (1) processor z(0) is the right end of the segment in  0 (2) if  j-1 ->  j is a step of P i by rule A and z(j-1) = i-1 then z(j) = i, else z(j)=z(j-1)... P i-1 z(j-1)  j-1 : P i P i+1...... P i-1 P i z(j) j:j: P i+1... Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 31

32 Definition (cont): a dynamic segment is a function s z from indices of computation into segments, such that s z (j) is a segment in  j whose right end is z(j).... P i s z (j) z(j) j:j: Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 32

33 Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 Claim: in a quiet computation gap sizes remain constant. (they only circulate around the ring.) 1.- 2.- 3.- 8.- 9.- 10.- 11.- 1.- 2.- 3.- 4.- 9.- 10.- 11.- formally … informally: 33

34 Lemma: Proof: Let C =  0  1 … be a quiet computation and z a dynamic gap of C. Then g(z(j-1),  j-1 ) = g(z(j),  j ) for all j. P i = z(j-1)+1 takes a step... P i-1 z(j-1)  j-1 : P i P i+1...... P i-1 P i z(j) j:j: P i+1... length > 1 P i  z(j-1)+1 takes a step - does not affect the gap Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 if P i takes a step and z(j)=i, the segment disappears – a contradiction PiPi z(j-1) g =L i -L i-1 L’ i+1 = L i +1 L’ i =L i-1 +1 34 gap size The gap persists length = 1

35 So: in a quiet computation gap sizes remain constant. (they only circulate around the ring.) Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 informally … Claim: For each dynamic segment in a quiet computation there is a configuration in which the right end has label 0, and there is a configuration in which the left end has label 0. For a dynamic gap z, g(z) denotes this common value. Formally g(z)= g(z(j),  j ). 35

36 1.- 2.- 3.- 8.- 9.- 10.- 11.- 1.- 2.- 3.- 4.- 5.- 10.- 11.- … 1.- 2.- 3.- 4.- 9.- 10.- 11.- … 1.- 2.- 3.- 4.- 5.- … 0.- 5.- Each processor takes infinite number of steps by Rule A Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 36

37 and from here on: … 1.- 2.- 3.- 4.- 5.- … 0.- 5.- 2.- 3.- 4.- 5.- … 0.- … … … 3.- 4.- 5.- … 0.- … … … 0.- … … Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 37

38 Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 Formally … Claim: For each dynamic segment in a quiet computation there is a configuration in which the right end has label 0, and there is a configuration in which the left end has label 0. 38

39 Proof: Consider z at a time j’. Lemma: Let C =  0  1 … be an infinite quiet computation and z a dynamic gap of C. Then there is j, such that the state of processor z(j) in  j is 0.g(z).... a.*  j' :... z(j’) Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 … the right end has label 0: Rule A will be applied to P i-1 and to P i. But it is applied to P i before it can applied to P i-1, otherwise the number of segments decreases, which is impossible since the computation is quiet. P i-1 P i 39

40 ... a.* (a+1).g(z)  j” :... z(j”) … 0.g(z) j:j:... z(j) Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 When Rule A is applied to P i we get from So eventually we get to a configuration P i P i+1... a.*  j' :... z(j’) P i P i+1 to 40

41 … the left end has label 0: Proof: we eventually get to a configuration Lemma: Let C =  0  1 … be an infinite quiet computation and z a dynamic gap of C. Then there is k  0, such that the state of processor z(k) +1 in  k is 0.u for some u.... szsz j:j: … 0.g(z’) P i z’(j)=P i+1 s z’ Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 If P i+1 is the first element of z’(j), then we are done. Else, consider the first time P i takes a step by rule A. 41

42 ... –. – k:k: 0.g(z’)... P i+1 szsz s z’ Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 We eventually get to a configuration So, from the configuration... szsz j:j: … 0.g(z’) P i z’(j)=P i+1 s z’ z(k)=P i We consider the first time P i takes a step by rule A. But therefore P i+1 cannot take any step by Rule A, so its label must remain 0. 42

43 Definition: A segment is well formed if all of its tags are equal to its gap size. Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 Claim: From some point all segments are well formed. Recall: we want to show that the number of segments is eventually reduced to one. 43

44 ... 0.g(z) Proof: Consider a specific segment. We get to Lemma: Let C =  0  1 … be an infinite quiet computation. Then there is j 0, such that for all j  j 0, all segments in  j are well formed. szsz j:j: z(j)=P i Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 We know that Rule A will be applied to P i+1. Rule A cannot be applied to P i earlier, since then the number of segments will decrease. Rule B cannot be applied to P i earlier, since L i =0. 44

45 ... 0.g(z) szsz j:j:... 0.g(z) 1.g(z) z(j)=P i z (j’ 1 )=P i+1 Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 So, when Rule A will be applied to P i+1 we get to We know that Rule A will be applied to P i+2. Rule A cannot be applied to P i earlier, since its L i =0. Rule B cannot be applied to P i and P i+1 earlier. We get to: … 0.g(z) 1.g(z) 2.g(z) z(j”)=P i+2  j” :  j’ : 45

46 0.g(z) 1.g(z) … *.g(z) j:j: z(j) Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 So, eventually we get to Where all tags in a segment are equal. Rule B cannot be applied within this segment. So this segment will remain well-formed from now on. Apply this argument, from this configuration, to the 2 nd, 3 rd, …, segment. So, eventually all segments are well-formed. 46

47 Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 Lemma: There is a point in every infinite computation after which every configuration has exactly one segment. Proof: f rom some point the computation is quiet, and all segments are well-formed. So, rule B cannot be applied. 47

48 Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 Claim: for all gaps, g(z)=0.... szsz z(j)=P i s z’ P i+1 0.g(z’) P i+1 can make a step only after P i, but such a step would destroy s z  contradiction Proof: if there is only one segment, the gap must be 0. Otherwise, consider a maximal gap, g(z)>0. Let z’ z. At some point z’ is 0 based 48

49 Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 So, all gaps have g(z)=0. There is either 1 segment of length n, or n segments of length 1. If we have n segments of length 1, then any Rule A decreases the number of segments – a contradiction. So, there is a single segment of length n, as desired. 49

50 … a-1.0 a.0a.0 a+1.0... with one well-formed segment, g(z) = 0, and all tags = 0. This is a legitimate configuration. This completes the proof. Eventually the system reaches a configuration  : :: Rule A: if L i  L i- 1 +1 and (L i  0 or T i- 1 = 0 or T i- 1  L i -L i- 1 or T i- 1 < T i ) then L i- 1.T i- 1 L i.T i  (L i- 1 +1).(L i -L i- 1 ) Rule B: if L i = L i- 1 +1 and L i  0 and T i- 1  T i then L i- 1.T i- 1 L i.T i  L i.T i- 1 Recall: the set of legitimate configurations,  is the set of all cyclic permutations of the form 0.0 1.0 … a-1.0 a.0 a.0 a+1.0 … n-2.0 for a=0, 1, …, n-2 50

51 Conclusion uniform ( no distinguished processor) O( n 2 ) states deterministic algorithm central scheduler We saw an algorithm for a ring of a prime size: unidirectional 51

52 Questions Can we find a simpler algorithm? Can we find an algorithm with o( n 2 ) states? Estimate the convergence time of the algorithm. Algorithms for other graphs? For Cayley graphs? 52 Give a lower bound for the number of states and the convergence time.


Download ppt "By J. Burns and J. Pachl Based on a presentation by Irina Shapira and Julia Mosin Uniform Self-Stabilization 1 P0P0 P1P1 P2P2 P3P3 P4P4 P5P5."

Similar presentations


Ads by Google