Presentation is loading. Please wait.

Presentation is loading. Please wait.

Common2 Extended to Stacks Adam Morrison joint with Eli Gafni Yehuda Afek.

Similar presentations


Presentation on theme: "Common2 Extended to Stacks Adam Morrison joint with Eli Gafni Yehuda Afek."— Presentation transcript:

1 Common2 Extended to Stacks Adam Morrison joint with Eli Gafni Yehuda Afek

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

3 Computability

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

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

6 Wait-free hierarchy Consensus number 1 2 … Stack Register [Herlihy 91]

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

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

9 Queue This talk Consensus number 1 2 … Stack F&A Swap Register Common2

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

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

12 Linearizability proof

13 Concurrent matching Push/Pop pairs can be ignored.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 Linearizing procedure that processes the execution, using an auxiliary array, and outputs a linearization. Proof technique aux

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

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

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

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

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

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

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

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

24 Queue Conclusion Consensus number 1 2 … Stack F&A Swap Register Common2 ?


Download ppt "Common2 Extended to Stacks Adam Morrison joint with Eli Gafni Yehuda Afek."

Similar presentations


Ads by Google