1 / 24

Common2 Extended to Stacks

Common2 Extended to Stacks. Adam Morrison joint with. Yehuda Afek. Eli Gafni. Model. Shared memory model. Wait-free linearizable algorithms. Computability. Stack. ?. Computability. Snapshot implementation from read-write registers.

yule
Télécharger la présentation

Common2 Extended to Stacks

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. Common2 Extendedto Stacks Adam Morrison joint with Yehuda Afek Eli Gafni

  2. Model • Shared memory model. • Wait-free linearizable algorithms.

  3. Computability

  4. Stack ? Computability Snapshot implementationfrom read-write registers. X implementationfrom stacks and read-write registers?

  5. Wait-free hierarchy [Herlihy 91] Object’s consensus number: Maximum number of processes that can implement consensus using copies of the object and R/W registers. … Consensusnumber 2 1

  6. Wait-free hierarchy [Herlihy 91] … Consensusnumber 2 Stack Register 1

  7. Wait-free hierarchy [Herlihy 91] F&A(x): old := v v += x return old swap(x): old := v v := x return old … F&A Consensusnumber Swap 2 Queue Stack Register 1

  8. Wait-free hierarchy [Herlihy 91] Common2 … More than 2 processes? F&A Consensusnumber Swap 2 Queue Stack Register 1

  9. This talk Common2 … F&A Consensusnumber Swap 2 Queue Stack Register 1

  10. Stack algorithm Ø Ø Ø Ø Ø Ø Ø cells r 0

  11. Swap Swap Stack algorithm Pop() { Push(x) { for t:=F&A(r,0)-1 t := F&A(r,1) downto 0 { cells[t] := x x := swap(cells[t], Ø) } if (x != Ø( return x } return EMPTY { Ø Wait-free Ø Ø Ø Ø Ø x Ø cells r Push(x) 1 2 0 Pop Push(y)

  12. Linearizability proof

  13. Linearizability proof • Concurrent matching Push/Pop pairs can be ignored. Obtain an execution where Pop starts after corresponding Push has finished. Push(x) Push(y) Pop: y Push(z) Pop: z

  14. Linearizability proof Linearizability: assign each operation a linearization point at some event during its execution. Handling ties: build explicit sequential order to breaks ties.

  15. Proof technique Linearizing procedure that processes the execution, using an auxiliary array, and outputs a linearization. aux

  16. Auxiliary array Lin=Push(y) Pop:y Push(x) x aux

  17. Linearizing Push() Push is linearized when it writes: If to top of array, linearized now. Else, with the Push above it. Push(z) z Lin=Push(y) Pop:y Push(x) Lin=Push(y) Pop:yPush(w)Push(x)Push(z) x Push(w) w aux

  18. EMPTY Linearizing Pop() Pops are linearized as soon as their return value is at top of the auxiliary array. Lin=Push(y) Pop:y Push(w) Push(x) Push(z) Pop:z Pop:x Pop:x Pop:z Pop:x Pop:z z z x x w w cells aux

  19. Linearization proc correctness • Linearization is a valid stack execution. • Linearization respects real-time order. 

  20. Linearizing Push() Push is linearized when it writes: If to top of array, linearized now. Else, with the Push above it.  Push(z) z F&A write Push(x) x  F&A write Push(w) w Push(w) aux

  21. Linearization proc correctness • Linearization is a valid stack execution. • Linearization respects real-time order. • Every operation is linearized.  

  22. Every Pop() is linearized Pops are linearized as soon as their return value is at top of the auxiliary array. Pop:x Pop:x Pop:z z z w w x x cells aux Pop:x – first to finish without being linearized

  23. Linearization proc correctness • Linearization is a valid stack execution. • Linearization respects real-time order. • Every operation is linearized.   

  24. Conclusion Common2 … F&A Consensusnumber Swap ? 2 Queue Stack Register 1

More Related