on helping and stacks
play

On Helping and Stacks Vitaly Aksenov, INRIA Paris / ITMO University - PowerPoint PPT Presentation

On Helping and Stacks Vitaly Aksenov, INRIA Paris / ITMO University Petr Kuznetsov, Telecom ParisTech Anatoly Shalyto, ITMO University NETYS 2018 1 / 21 Takeaway Linearization-based helping [Censor-Hillel et al., 2015]: a process takes a


  1. On Helping and Stacks Vitaly Aksenov, INRIA Paris / ITMO University Petr Kuznetsov, Telecom ParisTech Anatoly Shalyto, ITMO University NETYS 2018 1 / 21

  2. Takeaway ◮ Linearization-based helping [Censor-Hillel et al., 2015]: a process takes a step and fixes the order between two operations. ◮ Theorem: stack and queue do not have a wait-free help-free implementation using compare&swap and fetch&add. ◮ Proved for exact order types. ◮ Stack is not exact order type. ◮ We give a direct proof for stack. 2 / 21

  3. Outline Helping Original proof. Refutation Correct proof Conclusion 3 / 21

  4. Outline Helping Original proof. Refutation Correct proof Conclusion 4 / 21

  5. What is helping? ◮ Intuitively: an operation performs some work on behalf of another. ◮ Often appears in wait-free and lock-free algorithms. ◮ Examples: ◮ Universal wait-free construction [Herlihy, 1991]; ◮ Lock-free binary search tree [Ellen et al., 2010]. ◮ How to define helping formally? ◮ Linearization-based helping. 5 / 21

  6. Linearization function h f 6 / 21

  7. Helping. Decided before Definition 1 We say that op 1 is decided before op 2 in h with respect to f , if there exists no extension s of h such that op 2 ≺ f ( s ) op 1 . op 1 h op 2 s 1 s 2 f f 7 / 21

  8. Helping. Definition Definition 2 An implementation has helping if op 1 by p 1 is decided before op 2 by p 2 after a step of p 3 . op 1 op 2 op 3 f 8 / 21

  9. Helping. Definition Definition 2 An implementation has helping if op 1 by p 1 is decided before op 2 by p 2 after a step of p 3 . op 1 op 2 op 3 f 8 / 21

  10. Helping. Definition Definition 2 An implementation has helping if op 1 by p 1 is decided before op 2 by p 2 after a step of p 3 . op 1 op 2 op 3 f 8 / 21

  11. Helping. Definition Definition 2 An implementation has helping if op 1 by p 1 is decided before op 2 by p 2 after a step of p 3 . op 1 op 2 op 3 f 8 / 21

  12. Helping. Definition Definition 2 An implementation has helping if op 1 by p 1 is decided before op 2 by p 2 after a step of p 3 . op 1 op 2 op 3 f 8 / 21

  13. Helping. Definition Definition 2 An implementation has helping if op 1 by p 1 is decided before op 2 by p 2 after a step of p 3 . op 1 op 2 op 3 f 8 / 21

  14. Outline Helping Original proof. Refutation Correct proof Conclusion 9 / 21

  15. Exact Order Type There exist an operation op , an infinite sequence W and a sequence R such that for any n there exists m ... x op W 1 W n W n + 1 R 1 R i R m . . . . . . . . . . . . . . . . . . . . . . . . op W n + 1 W 1 W n R 1 R i R m y 10 / 21

  16. Exact Order Type. Queue ◮ op = enq ( 1 ) , W i = enq ( i + 1 ) and R i = deq () . ◮ Given n , we choose m = n + 1. 2 i + 1 n + 2 enq(2) enq( n + 1) enq( n + 2) deq() enq(1) deq() deq() op W 1 W n W n + 1 R 1 R i R n + 1 . . . . . . . . . . . . . . . . . . . . . . . . op W 1 W n R 1 R i W n + 1 R n + 1 enq(2) enq( n + 1) enq(1) deq() deq() enq( n + 2) deq() 2 i + 1 1 11 / 21

  17. Exact Order Type Theorem 3 (Censor-Hillel et al., 2015) Any exact order type does not have a wait-free help-free implementation in systems with compare&swap and fetch&add primitives. Theorem 4 Stack is not exact order type. 12 / 21

  18. Stack is not Exact Order Type n + 2 push(2) push( n + 1) push( n + 2) pop() push(1) pop() pop() op W 1 W n W n + 1 R 1 R i R n + 1 . . . . . . . . . . . . . . . . . . . . . . . . op W 1 W n R 1 R i W n + 1 R n + 1 push(2) push( n + 1) push(1) pop() pop() push( n + 2) pop() 1 13 / 21

  19. Stack is not Exact Order Type 1 push(2) push( n + 1) push( n + 2) push(1) pop() pop() pop() op W 1 W n W n + 1 R 1 R i R n + 1 . . . . . . . . . . . . . . . . . . . . . op W n + 1 R n + 1 W 1 W n R 1 R i push(2) push( n + 1) push(1) pop() pop() push( n + 2) pop() 1 13 / 21

  20. Stack is not Exact Order Type. Construction W ( n ) W ( n ) s ℓ s ℓ . . . . . . 14 / 21

  21. Stack is not Exact Order Type. Construction push( a ) push ( b ) W ( n ) ◦ W n + 1 W ( n ) ◦ op a b s ℓ s ℓ . . . . . . 14 / 21

  22. Stack is not Exact Order Type. Construction push ( b ) W ( n ) ◦ W n + 1 ◦ op W ( n ) ◦ op b a b s ℓ s ℓ . . . . . . 14 / 21

  23. Stack is not Exact Order Type. Construction W ( n ) ◦ W n + 1 ◦ op ◦ R ( x ) W ( n ) ◦ op ◦ R ( x ) . . . b . . . a b s ℓ s ℓ . . . . . . 14 / 21

  24. Stack is not Exact Order Type. Construction W ( n ) ◦ op ◦ R ( y − 1 ) W ( n ) ◦ W n + 1 ◦ op ◦ R ( y − 1 ) b a b s ℓ s ℓ . . . . . . 14 / 21

  25. Stack is not Exact Order Type. Construction W ( n ) ◦ W n + 1 ◦ op ◦ R ( y ) W ( n ) ◦ op ◦ R ( y ) a s ℓ s ℓ . . . . . . 14 / 21

  26. Stack is not Exact Order Type. Construction push ( a ) W ( n ) ◦ W n + 1 ◦ op ◦ R ( y ) W ( n ) ◦ op ◦ R ( y ) ◦ W n + 1 a a s ℓ s ℓ . . . . . . 14 / 21

  27. Outline Helping Original proof. Refutation Correct proof Conclusion 15 / 21

  28. Proof Theorem 5 Stack does not have a wait-free help-free implementation in a system with at least three processes and with compare&swap primitive. ◮ Programs: ◮ first process — push ( 1 ) ◮ second process — push ( 2 ) ◦ push ( 3 ) ◦ . . . ◮ third process — pop () ◦ pop () ◦ . . . ◮ We build a history in which the first process makes infinite number of steps, but never finishes. 16 / 21

  29. Proof. History Construction 1 h ← ǫ 2 op 1 ← push(1) 3 id 2 ← 2 4 while true: op 2 ← push( id 2 ) 5 while true: 6 if op 1 is not decided before op 2 in h ◦ p 1 : 7 h ← h ◦ p 1 8 continue 9 if op 2 is not decided before op 1 in h ◦ p 2 : 10 h ← h ◦ p 2 11 continue 12 break 13 h ← h ◦ p 2 14 h ← h ◦ p 1 15 while op 2 is not completed: 16 h ← h ◦ p 2 17 id 2 ← id 2 + 1 18 17 / 21

  30. Proof. History Construction push(1) 1 h ← ǫ p 1 2 op 1 ← push(1) 3 id 2 ← 2 p 2 . . . 4 while true: push(2) push(3) push( id 2 ) op 2 ← push( id 2 ) 5 while true: 6 if op 1 is not decided before op 2 in h ◦ p 1 : 7 h ← h ◦ p 1 8 continue 9 if op 2 is not decided before op 1 in h ◦ p 2 : 10 h ← h ◦ p 2 11 continue 12 break 13 h ← h ◦ p 2 14 h ← h ◦ p 1 15 while op 2 is not completed: 16 h ← h ◦ p 2 17 id 2 ← id 2 + 1 18 17 / 21

  31. Proof. History Construction push(1) 1 h ← ǫ p 1 2 op 1 ← push(1) 3 id 2 ← 2 p 2 . . . 4 while true: push(2) push(3) push( id 2 ) op 2 ← push( id 2 ) 5 while true: 6 if op 1 is not decided before op 2 in h ◦ p 1 : 7 h ← h ◦ p 1 8 continue 9 if op 2 is not decided before op 1 in h ◦ p 2 : 10 h ← h ◦ p 2 11 continue 12 break 13 h ← h ◦ p 2 14 h ← h ◦ p 1 15 while op 2 is not completed: 16 h ← h ◦ p 2 17 id 2 ← id 2 + 1 18 17 / 21

  32. Proof. History Construction push(1) 1 h ← ǫ p 1 2 op 1 ← push(1) 3 id 2 ← 2 p 2 . . . 4 while true: push(2) push(3) push( id 2 ) op 2 ← push( id 2 ) 5 while true: 6 if op 1 is not decided before op 2 in h ◦ p 1 : 7 h ← h ◦ p 1 8 continue 9 if op 2 is not decided before op 1 in h ◦ p 2 : 10 h ← h ◦ p 2 11 continue 12 break 13 h ← h ◦ p 2 14 h ← h ◦ p 1 15 while op 2 is not completed: 16 h ← h ◦ p 2 17 id 2 ← id 2 + 1 18 17 / 21

  33. Proof. History Construction push(1) 1 h ← ǫ p 1 2 op 1 ← push(1) 3 id 2 ← 2 p 2 . . . 4 while true: push(2) push(3) push( id 2 ) op 2 ← push( id 2 ) 5 while true: 6 if op 1 is not decided before op 2 in h ◦ p 1 : 7 h ← h ◦ p 1 8 continue 9 if op 2 is not decided before op 1 in h ◦ p 2 : 10 h ← h ◦ p 2 11 continue 12 break 13 h ← h ◦ p 2 14 h ← h ◦ p 1 15 while op 2 is not completed: 16 h ← h ◦ p 2 17 id 2 ← id 2 + 1 18 17 / 21

  34. Proof. History Construction push(1) 1 h ← ǫ p 1 2 op 1 ← push(1) 3 id 2 ← 2 p 2 . . . 4 while true: push(2) push(3) push( id 2 ) op 2 ← push( id 2 ) 5 while true: 6 if op 1 is not decided before op 2 in h ◦ p 1 : 7 h ← h ◦ p 1 8 continue 9 if op 2 is not decided before op 1 in h ◦ p 2 : 10 h ← h ◦ p 2 11 continue 12 break 13 h ← h ◦ p 2 14 h ← h ◦ p 1 15 while op 2 is not completed: 16 h ← h ◦ p 2 17 id 2 ← id 2 + 1 18 17 / 21

  35. Proof. History Construction push(1) 1 h ← ǫ p 1 . . . 2 op 1 ← push(1) c&s 3 id 2 ← 2 p 2 . . . . . . 4 while true: push(2) push(3) push( id 2 ) op 2 ← push( id 2 ) 5 while true: 6 if op 1 is not decided before op 2 in h ◦ p 1 : 7 h ← h ◦ p 1 8 continue 9 if op 2 is not decided before op 1 in h ◦ p 2 : 10 h ← h ◦ p 2 11 continue 12 break 13 h ← h ◦ p 2 14 h ← h ◦ p 1 15 while op 2 is not completed: 16 h ← h ◦ p 2 17 id 2 ← id 2 + 1 18 17 / 21

  36. Proof. History Construction push(1) 1 h ← ǫ p 1 . . . 2 op 1 ← push(1) 3 id 2 ← 2 p 2 . . . . . . 4 while true: c&s push(2) push(3) push( id 2 ) op 2 ← push( id 2 ) 5 while true: 6 if op 1 is not decided before op 2 in h ◦ p 1 : 7 h ← h ◦ p 1 8 continue 9 if op 2 is not decided before op 1 in h ◦ p 2 : 10 h ← h ◦ p 2 11 continue 12 break 13 h ← h ◦ p 2 14 h ← h ◦ p 1 15 while op 2 is not completed: 16 h ← h ◦ p 2 17 id 2 ← id 2 + 1 18 17 / 21

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend