1 / 27

Optimal Termination Detection for Rings

Optimal Termination Detection for Rings. Murat Demirbas OSU. Termination Detection in D.S. Message passing, Asynchronous execution A process is either active or passive Active processes: send and receive messages, can become passive spontaneously Passive processes:

stacy
Télécharger la présentation

Optimal Termination Detection for Rings

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. Optimal Termination Detection for Rings Murat Demirbas OSU

  2. Termination Detection in D.S. • Message passing, Asynchronous execution • A process is either active or passive • Active processes: • send and receive messages, • can become passive spontaneously • Passive processes: • can only receive messages, • can become active only by receiving a message.

  3. Termination detection problem • The system is terminated iff • all processes are passive • no messages in transit • The problem is to detect termination as and when the system terminated.

  4. Related work • Chandy & Lamport snapshot alg. • O(N2) time • Dijkstra & Safra token-based alg. • O(N) time, 2N -- 3N • Chandy alg. • 2N integers per process, and message • 2N2 integers at the detector • Sivilotti improved the space complexity

  5. Our algorithm • Based on Dijkstra&Safra alg. • Detection in 0 -- N time • each process maintains 1 int. + N bits • token stores N int. + N bits

  6. Outline • Dijkstra & Safra alg • Optimal alg • Enhancement 1 • Enhancement 2 • Proof

  7. Dijkstra & Safra algorithm • c.j = #mesgs sent - #mesgs received • The initiator obtains a snapshot • sends a token to the ring • gathers the sums of c.j’s • If the snapshot is consistent and no mesg in transit, termination is detected.

  8. Snapshot is inconsistent if the receipt of m is recorded but send of m is not. A process is blackened upon receiving a mesg A black node blackens the token Dijkstra & Safra alg (cont.) 1 N 2 3

  9. c.1 color.1 1 q color c.2 color.2 c.N color.N 2 N 3 c.3 color.3

  10. An optimal algorithm for Termination Detection on Rings • First enhancement (Enumeration bits) • Second enhancement (Multiple initiators) • Optimal algorithm = 1st & 2nd enh. combined

  11. 1st enhancement (enumeration bits) • Dijkstra & Safra blackens every process that receives a message. • However, a message reception violates the snapshot iff the receive of the message is included in the snapshotwhereas the send is not.

  12. 1 2 5 3 4

  13. 1st enhancement (enumeration bits) • The messages that violate the consistency are those sent by a process in the visited region to another process in the unvisited region. • A process sending a mesg piggybacks its enumeration bit + its process id. • j upon receiving “m” blackens itself iff: • enum.j  enum.m • j > sender_id.m

  14. An enumeration bit is sufficient ... 1 1 m+<1> 2 1 5 0 1 0 3 4

  15. 1st enhancement: N -- 2N 1 2 1 5 0 m+<1> 1 0 3 4

  16. 2nd Enhancement (Multiple initiators) • D&S alg has a fixed initiator: N • A vector [q1,q2,…,qN] maintains the sum, q, w.r.t. multiple initiators. • N -- 2N time to detect termination

  17. 1 [0,q2,q3,q4,q5] [0,0,0,0,0] [B,q2,q3,q4,0] [q1,0,0,0,0] 2 5 [B,q2,q3,0,B] [B,0,B,B,B] 3 4 [B,q2,0,B,B]

  18. The Optimal Algorithm • 2nd enh. blackens j::q.j and requires 2N. • 0--N if we do not blacken any q at 2, and q2, q3 at 4. 1 m2 2 4 m1 [q1,q2,q3,q4] 3

  19. The Optimal Algorithm(cont.) • We merge 1st & 2nd enh. • enum.j, enum.m, sender_id.m (1st enh.) • [q1,q2,…,qN], tok_color.[1…N] (2nd enh.) • color.j.k • color.j.k: j’s color w.r.t. initiator k • propagate and retransmit actions are merged into one action

  20. The Optimal Algorithm(cont.) • j receives m from l; • enum.j  enum.m and j > sender_id.m • m violates the consistency of the snapshot k::j  k  N  1  k  l • k:jkN  1kl: color.j.k := black

  21. Proof • W detects X: • W X • X leads-to W • Proof: • X: termination predicate • W: witness predicate • I: invariant • (I W) X • (I X) leads-to W

  22. Proof (cont) • X= ( (j:: idle.j)(#mesg_sent - #mesg_rcvd =0) ) • W= (j:: (tok@j)  (idle.j)  (color.j.j=white)  (c.j+q.j=0)  (tok_color.j=white) ) • I= ( (j::c.j) = #mesg_sent - #mesg_rcvd (I1)(i:: Q.i  R.i  S.i  T.i) ) • Q.i= ( (j:jVSTD.i: idle.j)  q.i= (j:jVSTD.i:c.j) ) • R.i= ( q.i+(j:jVSTD.i:c.j) > 0 ) • S.i= (j: jVSTD.i : color.j.i=black ) • T.i= (tok_color.i=black )

  23. Proof: (IW) X • Token is at j • W (1)tok@j  (2)idle.j  (3)color.j.j=white  (4)c.j+q.j=0  (5)tok_color.j=white • (1  3) S.j • (1  4) R.j • 5 T.j • (I S.j R.j T.j)  Q.j • (1  2  Q.j  4 I1)  X

  24. Proof: (IX) leads-toW in 0--N • (I  X)  (j:: idle.j) (j::c.j) = 0 • The only enabled action is Propagate Token • Let tok@j; then q.j=0, color.j.j=white, tok_color.j=white • Claim: (k:: color.k.j = white) • Then; tok_color.j=white is stable. • When tok@j again, (c.j+q.j = (j::c.j) = 0 ) • Therefore, within 1 cycle of token W is satisfied. • 0--N

  25. Proof: (k:: color.k.j = white) • Assume (k:: color.k.j = black). 3 cases to consider: • k<j : • color.k.j = black before token visits k leads-to color.k.j = white • color.k.j cannot be blackened by 1  i  k, since enum.i=enum.k • color.k.j cannot be blackened by k  i. • k=j : color.j.j=white • k>j : • sender_id  j thencolor.k.j is not blackened • sender_id > j then color.k.j is not blackened, since enum.sender_id =enum.k

  26. Conclusion • An optimal termination detection algorithm on rings 0--N

  27. New Results T.D. in Trees & Chandy’s model: • 2h--3h detection in trees • h detection in trees • Efficient T.D. in Chandy’s model: • 1--2 rounds to detect termination • requires just 1 integer + 1 bit in each process including DET. • Chandy: 2N integers in each process, 2N2 integers in DET.

More Related