1 / 27

Herman’s algorithm

Herman’s algorithm. Introduced by T. Herman (1990). An odd number of processors are arranged in a circle. An odd number of processors are arranged in a circle. An odd number of them have tokens. We want to get to a state with exactly one token.

tameka
Download Presentation

Herman’s algorithm

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. Herman’s algorithm Introduced by T. Herman (1990)

  2. An odd number of processors are arranged in a circle.

  3. An odd number of processors are arranged in a circle. An odd number of them have tokens. We want to get to a state with exactly one token.

  4. At each time step, every processor with a token either keeps it or passes it clockwise (independently, 50-50).

  5. At each time step, every processor with a token either keeps it or passes it clockwise (independently, 50-50).

  6. At each time step, every processor with a token either keeps it or passes it clockwise (independently, 50-50). When two tokens collide they annihilate each other.

  7. This eventually reaches a state with only one token. For a fixed initial configuration with N processors, how large can the expected time taken be?

  8. This eventually reaches a state with only one token. For a fixed initial configuration with N processors, how large can the expected time taken be? Herman (1990): it is O(N2logN).

  9. This eventually reaches a state with only one token. For a fixed initial configuration with N processors, how large can the expected time taken be? Herman (1990): it is O(N2logN). McIver and Morgan (2004): it is Θ(N2). Three equally-spaced tokens take time 4N2/27. Conjecture: this is the worst case.

  10. Three equally-spaced tokens take time 4N2/27. Conjecture: this is the worst case. Nakata (2005): any configuration has expected time at most N2(π2–8)/2 (about 6·3 times the conjectured bound).

  11. Three equally-spaced tokens take time 4N2/27. Conjecture: this is the worst case. Nakata (2005): any configuration has expected time at most N2(π2–8)/2 (about 6·3 times the conjectured bound). We get an upper bound of N2(π2–8)/12 (about 5% more than the conjectured bound).

  12. McIver and Morgan showed that if there are three tokens, with the distances between successive tokens being a,b,c, then the expected time is 4abc/N.

  13. McIver and Morgan showed that if there are three tokens, with the distances between successive tokens being a,b,c, then the expected time is 4abc/N. Here 32/7. 2 4 1

  14. McIver and Morgan showed that if there are three tokens, with the distances between successive tokens being a,b,c, then the expected time is 4abc/N. Can this approach be extended to more tokens?

  15. McIver and Morgan showed that if there are three tokens, with the distances between successive tokens being a,b,c, then the expected time is 4abc/N. Can this approach be extended to more tokens? Yes, sort of. Instead of each step taking time 1, give each step a cost of r if there were 2r+1 tokens at the start of that step. With 3 tokens, cost=time. With more, cost>time.

  16. We give an exact formula for the expected cost. For r≥1, take variables a1 ... a2r+1. A triple with even gaps is a term of the form aiajak with i<j<k and k–j, j–i even. This is preserved by cyclic shifts of the variables.

  17. We give an exact formula for the expected cost. For r≥1, take variables a1 ... a2r+1. A triple with even gaps is a term of the form aiajak with i<j<k and k–j, j–i even. This is preserved by cyclic shifts of the variables. Write steg(a1 ... a2r+1) for the sum of such triples. This sum has r(r+1)(2r+1)/6 terms.

  18. If r>1, what happens when one variable vanishes? steg(a1 ... a2r–1,0,a2r+1)= steg(a1 ... a2r–2, a2r–1+a2r+1)

  19. If r>1, what happens when one variable vanishes? steg(a1 ... a2r–1,0,a2r+1)= steg(a1 ... a2r–2, a2r–1+a2r+1) Suppose we have 2r+1 tokens, and distances between successive tokens are a1 ... a2r+1 in that order, so a1+ a2+···+a2r+1=N.

  20. If r>1, what happens when one variable vanishes? steg(a1 ... a2r–1,0,a2r+1)= steg(a1 ... a2r–2, a2r–1+a2r+1) Suppose we have 2r+1 tokens, and distances between successive tokens are a1 ... a2r+1 in that order, so a1+ a2+···+a2r+1=N. Taking one time step in the algorithm changes these distances to random variables ã1 ... ã2r+1.

  21. If r>1, what happens when one variable vanishes? steg(a1 ... a2r–1,0,a2r+1)= steg(a1 ... a2r–2, a2r–1+a2r+1) Suppose we have 2r+1 tokens, and distances between successive tokens are a1 ... a2r+1 in that order, so a1+ a2+···+a2r+1=N. Taking one time step in the algorithm changes these distances to random variables ã1 ... ã2r+1. E(steg(ã1 ... ã2r+1))= steg(a1 ... a2r+1)–rN/4.

  22. So the expected total cost from this starting state is 4steg(a1 ... a2r+1)/N. How big can this be?

  23. So the expected total cost from this starting state is 4steg(a1 ... a2r+1)/N. How big can this be? If x1 ... x2r+1 are non-negative with sum 1 then steg(x1 ... x2r+1)≤(1-(2r+1)–2 )/24 (the value taken when they are all equal). So for any r, expected cost < N2/6.

  24. We can get a tighter bound on the expected time. Fix a start state with 2r+1 tokens. Write As for the first configuration with ≤2s+1 tokens, Cs for the cost accumulated after that point, and T for the total time.

  25. We can get a tighter bound on the expected time. Fix a start state with 2r+1 tokens. Write As for the first configuration with ≤2s+1 tokens, Cs for the cost accumulated after that point, and T for the total time. T=∑s(Cs–Cs–1)/s = ∑sCs(s–1–(s+1)–1) = ∑sCss–1(s+1)–1.

  26. We can get a tighter bound on the expected time. Fix a start state with 2r+1 tokens. Write As for the first configuration with ≤2s+1 tokens, Cs for the cost accumulated after that point, and T for the total time. T=∑s(Cs–Cs–1)/s = ∑sCs(s–1–(s+1)–1) = ∑sCss–1(s+1)–1. E(Cs)=E(E(Cs|As))≤(1–(2s+1)–2 )N2/6.

  27. We can get a tighter bound on the expected time. Fix a start state with 2r+1 tokens. Write As for the first configuration with ≤2s+1 tokens, Cs for the cost accumulated after that point, and T for the total time. T=∑s(Cs–Cs–1)/s = ∑sCs(s–1–(s+1)–1) = ∑sCss–1(s+1)–1. E(Cs)=E(E(Cs|As))≤(1–(2s+1)–2 )N2/6. So E(T) ≤ ∑ss–1(s+1)–1(1–(2s+1)–2 )N2/6 = ∑ss–1(s+1)–1(4s2+4s)(2s+1)–2N2/6 = ⅔N2∑s(2s+1)–2 = N2(π2–8)/12.

More Related