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

on helping and stacks
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

On Helping and Stacks

Vitaly Aksenov, INRIA Paris / ITMO University Petr Kuznetsov, Telecom ParisTech Anatoly Shalyto, ITMO University NETYS 2018

1 / 21

slide-2
SLIDE 2

Takeaway

◮ Linearization-based helping [Censor-Hillel et al., 2015]: a process takes a step and fixes the order between two

  • perations.

◮ 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

slide-3
SLIDE 3

Outline

Helping Original proof. Refutation Correct proof Conclusion

3 / 21

slide-4
SLIDE 4

Outline

Helping Original proof. Refutation Correct proof Conclusion

4 / 21

slide-5
SLIDE 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

slide-6
SLIDE 6

Linearization function

h f

6 / 21

slide-7
SLIDE 7
  • Helping. Decided before

Definition 1

We say that op1 is decided before op2 in h with respect to f , if there exists no extension s of h such that op2 ≺f (s) op1.

  • p1
  • p2

h f s1 f s2

7 / 21

slide-8
SLIDE 8
  • Helping. Definition

Definition 2

An implementation has helping if op1 by p1 is decided before

  • p2 by p2 after a step of p3.
  • p1
  • p2
  • p3

f

8 / 21

slide-9
SLIDE 9
  • Helping. Definition

Definition 2

An implementation has helping if op1 by p1 is decided before

  • p2 by p2 after a step of p3.
  • p1
  • p2
  • p3

f

8 / 21

slide-10
SLIDE 10
  • Helping. Definition

Definition 2

An implementation has helping if op1 by p1 is decided before

  • p2 by p2 after a step of p3.
  • p1
  • p2
  • p3

f

8 / 21

slide-11
SLIDE 11
  • Helping. Definition

Definition 2

An implementation has helping if op1 by p1 is decided before

  • p2 by p2 after a step of p3.
  • p1
  • p2
  • p3

f

8 / 21

slide-12
SLIDE 12
  • Helping. Definition

Definition 2

An implementation has helping if op1 by p1 is decided before

  • p2 by p2 after a step of p3.
  • p1
  • p2
  • p3

f

8 / 21

slide-13
SLIDE 13
  • Helping. Definition

Definition 2

An implementation has helping if op1 by p1 is decided before

  • p2 by p2 after a step of p3.
  • p1
  • p2
  • p3

f

8 / 21

slide-14
SLIDE 14

Outline

Helping Original proof. Refutation Correct proof Conclusion

9 / 21

slide-15
SLIDE 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...

W1 . . . Wn Wn+1 R1 . . .

  • p

. . . Ri

x

. . . Rm W1 . . . Wn

  • p

R1 . . . Ri

y

. . . Wn+1 . . . Rm

10 / 21

slide-16
SLIDE 16

Exact Order Type. Queue

◮ op = enq(1), Wi = enq(i + 1) and Ri = deq(). ◮ Given n, we choose m = n + 1.

W1

enq(2)

. . . Wn

enq(n + 1)

Wn+1

enq(n + 2)

R1

deq()

2 . . .

  • p

enq(1)

. . . Ri deq() i + 1 . . . Rn+1

deq()

n + 2 W1

enq(2)

. . . Wn

enq(n + 1)

  • p

enq(1)

R1

deq()

2 . . . Ri deq() i + 1 . . . Wn+1

enq(n + 2)

. . . Rn+1

deq()

1

11 / 21

slide-17
SLIDE 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

slide-18
SLIDE 18

Stack is not Exact Order Type

W1

push(2)

. . . Wn

push(n + 1)

Wn+1

push(n + 2)

R1

pop()

n + 2 . . .

  • p

push(1)

. . . Ri

pop()

. . . Rn+1

pop()

W1

push(2)

. . . Wn

push(n + 1)

  • p

push(1)

R1

pop()

1 . . . Ri

pop()

. . . Wn+1

push(n + 2)

. . . Rn+1

pop() 13 / 21

slide-19
SLIDE 19

Stack is not Exact Order Type

W1

push(2)

. . . Wn

push(n + 1)

Wn+1

push(n + 2)

  • p

push(1)

R1

pop()

1 . . . Ri

pop()

. . . Rn+1

pop()

W1

push(2)

. . . Wn

push(n + 1)

  • p

push(1)

R1

pop()

1 . . . Ri

pop()

. . . Wn+1

push(n + 2)

. . . Rn+1

pop() 13 / 21

slide-20
SLIDE 20

Stack is not Exact Order Type. Construction

. . . sℓ W (n) . . . sℓ W (n)

14 / 21

slide-21
SLIDE 21

Stack is not Exact Order Type. Construction

. . . sℓ a W (n) ◦ Wn+1

push(a)

. . . sℓ b W (n) ◦ op

push(b)

14 / 21

slide-22
SLIDE 22

Stack is not Exact Order Type. Construction

. . . sℓ a b W (n) ◦ Wn+1 ◦ op

push(b)

. . . sℓ b W (n) ◦ op

14 / 21

slide-23
SLIDE 23

Stack is not Exact Order Type. Construction

. . . sℓ a b . . . W (n) ◦ Wn+1 ◦ op ◦ R(x) . . . sℓ b . . . W (n) ◦ op ◦ R(x)

14 / 21

slide-24
SLIDE 24

Stack is not Exact Order Type. Construction

. . . sℓ a b W (n) ◦ Wn+1 ◦ op ◦ R(y − 1) . . . sℓ b W (n) ◦ op ◦ R(y − 1)

14 / 21

slide-25
SLIDE 25

Stack is not Exact Order Type. Construction

. . . sℓ a W (n) ◦ Wn+1 ◦ op ◦ R(y) . . . sℓ W (n) ◦ op ◦ R(y)

14 / 21

slide-26
SLIDE 26

Stack is not Exact Order Type. Construction

. . . sℓ a W (n) ◦ Wn+1 ◦ op ◦ R(y) . . . sℓ a W (n) ◦ op ◦ R(y) ◦ Wn+1

push(a)

14 / 21

slide-27
SLIDE 27

Outline

Helping Original proof. Refutation Correct proof Conclusion

15 / 21

slide-28
SLIDE 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

slide-29
SLIDE 29
  • Proof. History Construction

1 h ← ǫ 2 op1 ← push(1) 3 id2 ← 2 4 while true: 5

  • p2 ← push(id2)

6

while true:

7

if op1 is not decided before op2 in h ◦ p1:

8

h ← h ◦ p1

9

continue

10

if op2 is not decided before op1 in h ◦ p2:

11

h ← h ◦ p2

12

continue

13

break

14

h ← h ◦ p2

15

h ← h ◦ p1

16

while op2 is not completed:

17

h ← h ◦ p2

18

id2 ← id2 + 1

17 / 21

slide-30
SLIDE 30
  • Proof. History Construction

1 h ← ǫ 2 op1 ← push(1) 3 id2 ← 2 4 while true: 5

  • p2 ← push(id2)

6

while true:

7

if op1 is not decided before op2 in h ◦ p1:

8

h ← h ◦ p1

9

continue

10

if op2 is not decided before op1 in h ◦ p2:

11

h ← h ◦ p2

12

continue

13

break

14

h ← h ◦ p2

15

h ← h ◦ p1

16

while op2 is not completed:

17

h ← h ◦ p2

18

id2 ← id2 + 1 p1

push(1)

p2

push(2) push(3) . . . push(id2)

17 / 21

slide-31
SLIDE 31
  • Proof. History Construction

1 h ← ǫ 2 op1 ← push(1) 3 id2 ← 2 4 while true: 5

  • p2 ← push(id2)

6

while true:

7

if op1 is not decided before op2 in h ◦ p1:

8

h ← h ◦ p1

9

continue

10

if op2 is not decided before op1 in h ◦ p2:

11

h ← h ◦ p2

12

continue

13

break

14

h ← h ◦ p2

15

h ← h ◦ p1

16

while op2 is not completed:

17

h ← h ◦ p2

18

id2 ← id2 + 1 p1

push(1)

p2

push(2) push(3) . . . push(id2)

17 / 21

slide-32
SLIDE 32
  • Proof. History Construction

1 h ← ǫ 2 op1 ← push(1) 3 id2 ← 2 4 while true: 5

  • p2 ← push(id2)

6

while true:

7

if op1 is not decided before op2 in h ◦ p1:

8

h ← h ◦ p1

9

continue

10

if op2 is not decided before op1 in h ◦ p2:

11

h ← h ◦ p2

12

continue

13

break

14

h ← h ◦ p2

15

h ← h ◦ p1

16

while op2 is not completed:

17

h ← h ◦ p2

18

id2 ← id2 + 1 p1

push(1)

p2

push(2) push(3) . . . push(id2)

17 / 21

slide-33
SLIDE 33
  • Proof. History Construction

1 h ← ǫ 2 op1 ← push(1) 3 id2 ← 2 4 while true: 5

  • p2 ← push(id2)

6

while true:

7

if op1 is not decided before op2 in h ◦ p1:

8

h ← h ◦ p1

9

continue

10

if op2 is not decided before op1 in h ◦ p2:

11

h ← h ◦ p2

12

continue

13

break

14

h ← h ◦ p2

15

h ← h ◦ p1

16

while op2 is not completed:

17

h ← h ◦ p2

18

id2 ← id2 + 1 p1

push(1)

p2

push(2) push(3) . . . push(id2)

17 / 21

slide-34
SLIDE 34
  • Proof. History Construction

1 h ← ǫ 2 op1 ← push(1) 3 id2 ← 2 4 while true: 5

  • p2 ← push(id2)

6

while true:

7

if op1 is not decided before op2 in h ◦ p1:

8

h ← h ◦ p1

9

continue

10

if op2 is not decided before op1 in h ◦ p2:

11

h ← h ◦ p2

12

continue

13

break

14

h ← h ◦ p2

15

h ← h ◦ p1

16

while op2 is not completed:

17

h ← h ◦ p2

18

id2 ← id2 + 1 p1

push(1)

p2

push(2) push(3) . . . push(id2)

17 / 21

slide-35
SLIDE 35
  • Proof. History Construction

1 h ← ǫ 2 op1 ← push(1) 3 id2 ← 2 4 while true: 5

  • p2 ← push(id2)

6

while true:

7

if op1 is not decided before op2 in h ◦ p1:

8

h ← h ◦ p1

9

continue

10

if op2 is not decided before op1 in h ◦ p2:

11

h ← h ◦ p2

12

continue

13

break

14

h ← h ◦ p2

15

h ← h ◦ p1

16

while op2 is not completed:

17

h ← h ◦ p2

18

id2 ← id2 + 1 p1

push(1)

p2

push(2) push(3) . . . push(id2) . . . . . . c&s

17 / 21

slide-36
SLIDE 36
  • Proof. History Construction

1 h ← ǫ 2 op1 ← push(1) 3 id2 ← 2 4 while true: 5

  • p2 ← push(id2)

6

while true:

7

if op1 is not decided before op2 in h ◦ p1:

8

h ← h ◦ p1

9

continue

10

if op2 is not decided before op1 in h ◦ p2:

11

h ← h ◦ p2

12

continue

13

break

14

h ← h ◦ p2

15

h ← h ◦ p1

16

while op2 is not completed:

17

h ← h ◦ p2

18

id2 ← id2 + 1 p1

push(1)

p2

push(2) push(3) . . . push(id2) . . . . . . c&s

17 / 21

slide-37
SLIDE 37
  • Proof. History Construction

1 h ← ǫ 2 op1 ← push(1) 3 id2 ← 2 4 while true: 5

  • p2 ← push(id2)

6

while true:

7

if op1 is not decided before op2 in h ◦ p1:

8

h ← h ◦ p1

9

continue

10

if op2 is not decided before op1 in h ◦ p2:

11

h ← h ◦ p2

12

continue

13

break

14

h ← h ◦ p2

15

h ← h ◦ p1

16

while op2 is not completed:

17

h ← h ◦ p2

18

id2 ← id2 + 1 p1

push(1)

p2

push(2) push(3) . . . push(id2) . . . . . . c&s c&s

17 / 21

slide-38
SLIDE 38
  • Proof. History Construction

1 h ← ǫ 2 op1 ← push(1) 3 id2 ← 2 4 while true: 5

  • p2 ← push(id2)

6

while true:

7

if op1 is not decided before op2 in h ◦ p1:

8

h ← h ◦ p1

9

continue

10

if op2 is not decided before op1 in h ◦ p2:

11

h ← h ◦ p2

12

continue

13

break

14

h ← h ◦ p2

15

h ← h ◦ p1

16

while op2 is not completed:

17

h ← h ◦ p2

18

id2 ← id2 + 1 p1

push(1)

p2

push(2) push(3) . . . push(id2) . . . . . . c&s c&s . . .

17 / 21

slide-39
SLIDE 39
  • Proof. History Construction

1 h ← ǫ 2 op1 ← push(1) 3 id2 ← 2 4 while true: 5

  • p2 ← push(id2)

6

while true:

7

if op1 is not decided before op2 in h ◦ p1:

8

h ← h ◦ p1

9

continue

10

if op2 is not decided before op1 in h ◦ p2:

11

h ← h ◦ p2

12

continue

13

break

14

h ← h ◦ p2

15

h ← h ◦ p1

16

while op2 is not completed:

17

h ← h ◦ p2

18

id2 ← id2 + 1 p1

push(1)

p2

push(2) push(3) . . . push(id2) . . . . . . c&s c&s . . .

17 / 21

slide-40
SLIDE 40

Outline

Helping Original proof. Refutation Correct proof Conclusion

18 / 21

slide-41
SLIDE 41

Conclusion

Theorem 6

There does not exist a help-free wait-free implementation of stack in systems: – with at least three processes and compare&swap primitive; – with at least four processes, and compare&swap and fetch&add primitives. ◮ We showed that the undirect proof of the theorem provided by Censor-Hillel et al. does not work for stack. ◮ We provide the direct proof of the theorem for stack.

19 / 21

slide-42
SLIDE 42

Related work

◮ Common2 class of objects. Common2 contains stack. What about queue? ◮ Valency-based helping by [Attiya et al., 2016]. ◮ Is there any other useful helping formalizations?

20 / 21

slide-43
SLIDE 43

Questions

Thank you for attention!

21 / 21