1 the computability of relaxed data structures: queues and stacks as examples the computability of...

28
1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples Nir Shavit and Gadi Taubenfeld Version: August 2015 SIROCCO 2015 Gadi Taubenfeld © 2015

Upload: randolph-brown

Post on 18-Jan-2018

222 views

Category:

Documents


0 download

DESCRIPTION

3 Why to relax ?  Synchronization inherently limits parallelism.  Semantically weaker DS reduce the need from synchronization.  Thus, provides potential to achieve better performance and scalability.  Thus, provides potential to achieve better performance and scalability.  There are many published efficient implementations of relaxed data structures. (See related work.)  There are many published efficient implementations of relaxed data structures. (See related work.)  We are interested in computability not complexity.  We are interested in computability not complexity. SIROCCO 2015Gadi Taubenfeld © 2015

TRANSCRIPT

Page 1: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

1

The Computability of Relaxed Data Structures:Queues and Stacks as Examples

Nir Shavit and Gadi Taubenfeld

Version: August 2015

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 2: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

2

Semantics of concurrent data structures

Sequential specification -- set of legal runs/sequences.

Consistency condition -- e.g. linearizability, sequential consistency, …

relaxed

This paper

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 3: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

3

Why to relax ?

Synchronization inherently limits parallelism. Semantically weaker DS reduce the need from synchronization.

Thus, provides potential to achieve better performance

and scalability. There are many published efficient implementations

of relaxed data structures. (See related work.) We are interested in

computability not complexity.

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 4: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

4

Queue[a,b,c]

enqueue dequeue

peek

a b

c

* -- can insert/remove/return a value at arbitrary position 0 -- operation not supported

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 5: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

5

Stack[a,b,c]

push pop

top

a b

c

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 6: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

6

Queue[a,b,c]

enqu

eue

dequ

eue

peek

Queue[1,1,1] -- traditional FIFO queue Queue[1,1,0] -- does not support peek Queue[1,1,*] -- peek returns a random value

Stack[ 1,0,1] -- atomic read/write register

Queue[*,*,0] = Stack[*,*,0] -- multiset object

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 7: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

7

Object Consensus number

queue[1,1,1]

queue[*,*,0], queue[1,1,0] 2stack[*,*,0], stack[1,1,0],

stack[1,1,1] 2

atomic register, stack[1,0,1] 1

Objects are wait-free & linearizable

Consensus Numberknown results

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 8: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

8

Relaxing the enqueue operation

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 9: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

9

Relaxing the enqueue operationObject Consensus number

queue[1,1,1]

queue[2,1,1]queue[3,1,1]

…queue[*,1,1]queue[*,2,1]queue[*,3,1]

…queue[*,*,1]queue[*,*,2]

queue[*,*,0] 2

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 10: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

10

Relaxing the enqueue operationObject Consensus number

queue[1,1,1]

queue[2,1,1]queue[3,1,1]

…queue[*,1,1] 2queue[*,2,1]queue[*,3,1]

…queue[*,*,1]queue[*,*,2]

queue[*,*,0] 2

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 11: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

11

Relaxing the enqueue operationObject Consensus number

queue[1,1,1]

queue[2,1,1]queue[3,1,1]

…queue[*,1,1] 2queue[*,2,1] 2queue[*,3,1] 2

… 2queue[*,*,1] 2queue[*,*,2] 2

2queue[*,*,0] 2

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 12: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

12

Relaxing the enqueue operationObject Consensus number

queue[1,1,1]

queue[2,1,1]

queue[3,1,1]

queue[*,1,1] 2queue[*,2,1] 2queue[*,3,1] 2

… 2queue[*,*,1] 2queue[*,*,2] 2

2queue[*,*,0] 2

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 13: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

13

Relaxing the enqueue operationObject Consensus number

queue[1,1,1], queue[1,0,1]

queue[2,1,1], queue[2,0,1]

queue[3,1,1], queue[3,0,1]

… …

queue[*,1,1] 2queue[*,2,1] 2queue[*,3,1] 2

… 2queue[*,*,1] 2queue[*,*,2] 2

2queue[*,*,0] 2SIROCCO 2015 Gadi Taubenfeld ©

2015

Page 15: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

15

Relaxing the peek operationObject Consensus number

queue[1,1,1]

queue[1,1,2]queue[1,1,3]

…queue[1,1,*]queue[1,2,*]queue[1,3,*]

…queue[1,*,*]queue[2,*,*]

queue[*,*,0] 2

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 16: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

16

Relaxing the peek operationObject Consensus number

queue[1,1,1]

queue[1,1,2] 2queue[1,1,3]

…queue[1,1,*]queue[1,2,*]queue[1,3,*]

…queue[1,*,*]queue[2,*,*]

queue[*,*,0] 2

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 17: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

17

Relaxing the peek operationObject Consensus number

queue[1,1,1]

queue[1,1,2] 2queue[1,1,3] 2

… 2queue[1,1,*] 2queue[1,2,*] 2queue[1,3,*] 2

… 2queue[1,*,*] 2queue[2,*,*] 2

2queue[*,*,0] 2

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 19: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

19

Relaxing the dequeue operationObject Consensus number

queue[1,1,1], queue[1,0,1]

queue[1,1,2] 2queue[1,2,2]

…queue[1,*,2]queue[1,*,3]queue[1,*,4]

…queue[1,*,*]queue[2,*,*]

queue[*,*,0] 2SIROCCO 2015 Gadi Taubenfeld ©

2015

Page 20: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

20

Relaxing the dequeue operationObject Consensus number

queue[1,1,1], queue[1,0,1]

queue[1,1,2] 2queue[1,2,2] 2

… 2queue[1,*,2] 2queue[1,*,3] 2queue[1,*,4] 2

… 2queue[1,*,*] 2queue[2,*,*] 2

2queue[*,*,0] 2

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 21: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

21

Not supporting the dequeue operationObject Consensus number

queue[1,1,1], queue[1,0,1]

queue[1,1,2] 2queue[1,0,2]queue[2,0,2]queue[3,0,2]

…queue[*,0,2]queue[0,0,2] 1

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 22: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

22

Not supporting the dequeue operationObject Consensus number

queue[1,1,1], queue[1,0,1]

queue[1,1,2] 2queue[1,0,2] 1queue[2,0,2]queue[3,0,2]

…queue[*,0,2]queue[0,0,2] 1

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 23: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

23

Not supporting the dequeue operationObject Consensus number

queue[1,1,1], queue[1,0,1]

queue[1,1,2] 2queue[1,0,2] 1queue[2,0,2] 1queue[3,0,2] 1

… 1queue[*,0,2] 1queue[0,0,2] 1

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 25: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

25

Atomic registers vs. relaxed queuesObject Consensus number

queue[1,1,1], queue[1,0,1]

queue[1,1,2] 2queue[1,0,2] 1queue[2,0,2] 1queue[3,0,2] 1

… 1queue[*,0,2] 1

Atomic registers 1

yes

???

Can atomic registers implement … ?

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 26: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

26

Atomic registers vs. relaxed queuesObject Consensus number

queue[1,1,1], queue[1,0,1]

queue[1,1,2] 2queue[1,0,2] 1queue[2,0,2] 1queue[3,0,2] 1

… 1queue[*,0,2] 1

Atomic registers 1

yes

No!!!

Theorem: A queue[a,0,c] has no wait-free implementation from atomic registers, for every two positive integers a and c.

SIROCCO 2015 Gadi Taubenfeld © 2015

Page 27: 1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples

27

Discussion Each one of the infinitely many relaxed objects

has one of the following consensus numbers: 1, 2, . Why only three?

Queue is more sensitive than stack to changes in its semantics.

Consider other types of relaxed data structures. What is the internal structure among relaxed

objects with the same consensus number? queue[1,1,0] + registers queue[1,1,2] ?

SIROCCO 2015 Gadi Taubenfeld © 2015