27
Herman’s algorithm Introduced by T. Herman (1990)

Herman’s algorithm Introduced by T. Herman (1990)

Embed Size (px)

Citation preview

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.

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

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

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

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?

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).

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.

Three equally-spaced tokens take time 4N2/27. Conjecture: this is the worst case.

Nakata (2005): any configuration has expectedtime at most N2(π2–8)/2(about 6·3 times the conjectured bound).

Three equally-spaced tokens take time 4N2/27. Conjecture: this is the worst case.

Nakata (2005): any configuration has expectedtime 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).

McIver and Morgan showed that if there arethree tokens, with the distances between successivetokens being a,b,c, then the expected time is4abc/N.

McIver and Morgan showed that if there arethree tokens, with the distances between successivetokens being a,b,c, then the expected time is4abc/N.

Here 32/7.

4

2

1

McIver and Morgan showed that if there arethree tokens, with the distances between successivetokens being a,b,c, then the expected time is4abc/N. Can this approach be extended tomore tokens?

McIver and Morgan showed that if there arethree tokens, with the distances between successivetokens being a,b,c, then the expected time is4abc/N. Can this approach be extended tomore tokens?

Yes, sort of. Instead of each step taking time 1,give each step a cost of r if there were 2r+1tokens at the start of that step. With 3 tokens, cost=time. With more, cost>time.

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 formaiajak with i<j<k and k–j, j–i even.

This is preserved by cyclic shifts of the variables.

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 formaiajak 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.

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

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 betweensuccessive tokens are a1 ... a2r+1 in that order, so

a1+ a2+···+a2r+1=N.

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 betweensuccessive 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.

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 betweensuccessive 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.

So the expected total cost from this starting stateis 4steg(a1 ... a2r+1)/N.

How big can this be?

So the expected total cost from this starting stateis 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.

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.

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.

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.

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.