1 / 33

by J. Burns and J. Pachl

Uniform Self-Stabilization. by J. Burns and J. Pachl. Prepared by: Irina Shapira Julia Mosin Modified by Mordo Shalom. Self-Stabilizing System: S = (G, R,  ,  ). G = (V,E). R - orientation of G specifies a total ordering on the neighbors for each v in V.

lucien
Download Presentation

by J. Burns and J. Pachl

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Uniform Self-Stabilization by J. Burns and J. Pachl Prepared by: Irina Shapira Julia Mosin Modified by Mordo Shalom

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

  3. Self-Stabilizing System: S = (G, R, , ) • For configuration  = (s0, s1, … , sn-1)   where • sj is a state of Pj (for all j). • x - possible next state of Pi , • i.e. if R(vi) = (v1, . . ., vk ) then (si,sv1, …, svk , x)  i we define i () as a set of all configurations ’ such that ’ = (s0,s1, …, si-1, x, si+1, …, sn-1) (for all possible values of x)

  4. Self-Stabilizing System: S = (G, R, , ) • Pi is enabled (privileged) at  if i () is not empty •  -> ’is a step of Pi if ’ i () i •  -> ’is a step of Pi 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

  5. An n-processor uniform ring is a system S = (G, R, , ) where • G is a cycle • processors are denoted by 0,1, …, n-1 in order around the cycle • R(i) = ( (i-1) mod n, (i+1) mod n ) P1 P0 • 0 =1 = . . . =n-1 P2 • 0 =1 = . . . =n-1 P5 P3 P4

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

  7. Theorem 1: There is no uniform n-processor self-stabilizing ring if n is composite. Proof: • [i] = {Pj | j = i mod p} • Sym()  all the Pj in [i] are in the same state in  • if Sym(0) holds, we can construct an infinite computation for which Sym(i) holds for every i s1 s0 P1 s0 s2 s0 s2 P0 P2 0: 1: 2: P5 P3 s0 s1 s0 s1 P4 s0 s2

  8. If the size of the ring is prime: • deterministic algorithm • no distinguished processor • central demon • ( n2 ) states

  9. The Protocol: • deterministic • unidirectional (the value of di(si, si-1, si+1) depends only on si and si-1) si-1si -> x means that x di(si,si-1,si+1) for any si+1

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

  11. The rule: if sisi-1+1 then si-1sisi-1+1 The cycle of the intended legitimate configurations P0 P1 P2 P3 P4 0 0 1 2 3 0 0 1 2 3 0 0 1 1 2 3 P0 P0 P0 0 1 2 2 3 0 1 2 3 3 P4 P4 P4 P1 P1 P1 1 0 0 0 3 3 0 1 2 3 0 ... P2 P3 P2 P3 P3 P2 1 2 2 1 3 2 0 0 1 2 3

  12. The rule: if sisi-1+1 then si-1sisi-1+1 The cycle which does not intersect the cycle of the legitimate configurations P0 P1 P2 P3 P4 0 1 20 1 0 1 20 1 0 1 2 0 0 1 2 31 21 2 31 P0 P0 P0 P0 P0 P0 P0 21 2 3 0 2 32 3 0 P1 P1 P1 P1 P1 P1 P1 P4 P4 P4 P4 1 P4 P4 3 1 2 1 0 1 132 30 13 03 0 1 203 0 P2 P2 P2 P2 P2 P2 P2 P3 P3 P3 P3 P3 P3 P3 0 1 20 10 1 3 2 2 0 0 ... 0 1 20 1 livelock

  13. A Correct Protocol

  14. The Protocol: • n  3 • states are label.tag (Li.Ti) • labels range over { 0, 1, …, n-2 } • tags range over { 0 } U { 2, 3, …, n-2 } Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li  0 and Ti-1 Ti then Li-1.Ti-1 Li.TiLi.Ti-1

  15. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 The Proof of Self-Stabilization: S = (G, R, , ) LetLbe 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 3: If n is prime, then the ring is self-stabilizing(and Lis a set of legitimate configurations)

  16. Definition 2: • Let gG be a configuration • if Li+1 Li+1 (mod n-1), then Pi and Pi+1 forma gap of g • the gap size (of Pi and g) g(i,g) = Li+1- Li (mod n-1) • a segment of g is a maximal cyclically contiguous sequence s=(Pi, Pi+1, …, Pj-1, Pj ) which contains no gaps • Pi is the left end of s, Pj is the right end of s • the gap size of s g(s,g) is the gap size of its right end (g(j,g)) • a segment is zero based if its left end is 0 (Li = 0) Example: P0 P1 P2 P3 P4 P5 P6 1.3 2.3 3.1 5.2 0.2 1.1 0.4 P0 P1 P2 P3 P4 P5 P6 1.3 2.3 3.1 5.2 0.2 1.1 0.4 (P6 P0 P1 P2) zero based segment gap of size 5 gap of size 2

  17. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 P0 P1 P2 P3 P4 1.0 2.0 3.32.33.0 0.22.03.32.33.0 0.2 1.0 1.0 0.21.23.32.33.0 P0 P0 P0 P0 P0 0.21.23.32.3 3.3 0.21.23.30.33.3 P1 P1 P1 P1 P1 P4 P4 P4 P4 P4 P4 P4 0.21.23.30.31.3 P4 P4 2.0 1.2 2.0 0.2 1.0 3.0 1.3 3.3 0.21.22.20.31.3 0.21.22.23.2 1.3 0.21.22.23.2 0.2 P2 P2 P2 P2 P2 P3 P3 P3 P3 P3 P3 P3 1.01.22.23.2 0.2 0.0 3.3 2.3 3.2 3.0 0.3 2.2 1.02.02.23.2 0.2 1.02.03.03.2 0.2 1.02.03.00.0 0.2 1.02.03.00.0 1.0

  18. Definition 1: A system S = (G, R, , ) is self-stabilizing iff there is a set , called the legitimate configurations of S, such that: (1) No Deadlock (2) Closure (3) No Livelock (4) Mutual Exclusion (5) Fairness

  19. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Lemma 1: Conditions 2 (Closure), 4 (Mutual Exclusion), and 5 (Fairness) of Definition 1 hold for L and S. Proof: • all configurations in Lare cyclic permutations of the forml = 0.0 1.0 … a-1.0 a.0 a.0 a+1.0 … n-2.0 • Ti = Tj for all i and j, hence rule B does not apply • rule A applies to exactly one processor - Mutual Exclusion • l -> l’by rule A l’ = 0.0 1.0 … a-1.0 a.0 a+1.0 a+1.0 … n-2.0 • l’  L- Closure • if Pi is enabled in l , then Pi+1(mod n) will be enabled in l ’- Fairness

  20. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Lemma 2: If n is prime, then some processor is enabled for every configuration in G, and therefore Condition 1 (No Deadlock) holds Proof: • if rule A doesn’t apply, then all the segments are zero-based … Li-1.Ti-1 0.Ti . … • Case 1: one zero-based segment of length n … 0.Ti-1 0.Ti ... if Ti-1 = 0 rule A applies else Ti-1  0 and so Ti-1  Li - Li-1 and again rule A applies

  21. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 • Case 2: there is more than one segment rule B is not applicable - all tags within each segment are equal ... 0.t2 1.t2 … m2.t2 0.tl 1.tl … ml.tl 0.t1 1.t1 … m1.t1 rule A doesn’t apply - Ti-1= Li- Li-1for each gap tj = 0 - mj rule A doesn’t apply - tj  tj+1for each gap 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 0.0 0.0 and rule A applies for every gap

  22. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Lemma 3: In every infinite computation of S, every processor takes a step by rule A infinitely many times Proof: • if somePi takes an infinite number of steps by rule A, so do all • suppose that there is no such Pi • all labels are fixed and so are all segments • the left end of the segment cannot take a step by rule B • Pi which is not the left end can take at most one step more than Pi-1 Pi … ... Pi-1

  23. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Lemma 4: For any computation of S, the number of segments is nonincreasing. Proof: • rule B does not change the number of segments • rule A cannot increase the number of segments … Pi-1 Pi Pi+1 … … Pi-1 Pi Pi+1 … Pi … Pi-1 Pi … Pi-1 Pi+1 … Pi+1 …

  24. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Definition: A computation in which the number of segments is constant is called quiet.

  25. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Definition : Let C = g0g1 … 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 g0 (2) if gj-1-> gj is a step of Pi by rule A and z(j-1) = i-1 then z(j) = i, else z(j)=z(j-1) z(j-1) gj-1: Pi Pi+1 ... ... Pi-1 z(j) gj: Pi+1 ... ... Pi-1 Pi

  26. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Definition (cont): • a dynamic segmentis a function sz from indices of computation into segments, such that sz(j) is a segment ingj whose right end is z(j). sz(j) gj: ... Pi z(j)

  27. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Lemma 5: Let C = g0g1 … be a quiet computation and z a dynamic gap of C. Then g(z(j-1), gj-1) = g(z(j), gj) for 0 < j < length(C). Proof: • Pi= z(j-1)takes a step - the segment disappears-contradiction z(j-1) Pi • Piz(j-1)+1takes a step - does not affect the gap • Pi=z(j-1)+1 takes a step length > 1 z(j-1) gj-1: Pi Pi+1 ... ... Pi-1 g =Li-Li-1 z(j) L’i+1=Li +1 L’i=Li-1+1 gj: Pi+1 ... ... Pi-1 Pi

  28. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Lemma 6: • Let C = g0g1 … be an infinite quiet computation and z a dynamic gap of C. Then • there is j0, such that the state of processor z(j) in gj is 0.g(z) and • there is k0, such that the state of processor z(k) +1 in gk is 0.u for some u Proof: sz gj1: ... a.* ... z(j1) gj2: ... ... a.* (a+1).g(z) z(j2) ... at most n-1 times gj: … 0.g(z) ... z(j)

  29. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Lemma 6 (b): • Let C = g0g1 … be an infinite quiet computation and z a dynamic gap of C. Then there is j0, such that the state of processor z(j) in gj is 0.g(z) and • there is k0, such that the state of processor z(k) +1 in gk is 0.u for some u Proof: sz sz’ gj: ... … Pi 0.g(z’) z’(j)=Pi+1 ... sz’ sz gk: 0.g(z’) ... ... Pi z(k) Pi+1

  30. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Definition: A segment is well formed if all its tags are equal to its gap size.

  31. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Lemma 7: Let C = g0g1 … be an infinite quiet computation. Then there is j0  0, such that for all j  j0 all segments in gj are well formed Proof: sz gj1: ... 0.g(z) z(j1)=Pi gj’1: ... 0.g(z) 1.g(z) z(j’1)=Pi+1 ... gj’m: … 0.g(z) 1.g(z) … m.g(z) z(j’m)=Pi+m ... gj2: 0.g(z) 1.g(z) … *.g(z) z(j2)

  32. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Lemma 8: There is a point in every infinite computation of S after which every configuration has exactly one segment. Proof: C’ - quiet computation with well formed segments - rule B is void If for all dynamic gaps of C’ g(z) were 0, then there would be only one segment … a.0 a.0... If there is some dynamic gap of C’ such that its size is greater than 0: sz sz’ a.g(z) 0.g(z’) g(z)  g(z’) and g(z)  0 ... ... z(j1)=Pi Pi+1 Pi+1 can make a step only after Pi, but such a step would destroy sz contradiction

  33. Rule A: if Li  Li-1+1 and (Li0 or Ti-1=0 or Ti-1Li-Li-1 or Ti-1<Ti) then Li-1.Ti-1Li.Ti (Li-1+1).(Li-Li-1) Rule B: if Li = Li-1+1 and Li0 and Ti-1 Tithen Li-1.Ti-1 Li.TiLi.Ti-1 Conclusion: The system never livelocks. Proof: After finitely many step the system reaches the following configuration : : … a-1.0 a.0 a.0a+1.0 ... one well formed segment, g(z) = 0, all tags are 0 Recall:the set of legitimate configurationsLis 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 Hence,  is a legitimate configuration

More Related