1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples Nir Shavit and Gadi Taubenfeld Version: August 2015 SIROCCO 2015Gadi Taubenfeld © 2015
2 Semantics of concurrent data structures Sequential specification -- set of legal runs/sequences. Sequential specification -- set of legal runs/sequences. Consistency condition -- e.g. linearizability, sequential consistency, … Consistency condition -- e.g. linearizability, sequential consistency, … relaxed This paper SIROCCO 2015Gadi Taubenfeld © 2015
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
4 Queue[a,b,c] enqueuedequeue peek ab c * -- can insert/remove/return a value at arbitrary position 0 -- operation not supported SIROCCO 2015Gadi Taubenfeld © 2015
5 Stack[a,b,c] pushpop top ab c SIROCCO 2015Gadi Taubenfeld © 2015
6 Queue[a,b,c] enqueue dequeue 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 2015Gadi Taubenfeld © 2015
7 Objects are wait-free & linearizable Consensus Number known results SIROCCO 2015Gadi Taubenfeld © 2015
8 Relaxing the enqueue operation SIROCCO 2015Gadi Taubenfeld © 2015
9 Relaxing the enqueue operation SIROCCO 2015Gadi Taubenfeld © 2015
10 Relaxing the enqueue operation SIROCCO 2015Gadi Taubenfeld © 2015
11 Relaxing the enqueue operation SIROCCO 2015Gadi Taubenfeld © 2015
12 Relaxing the enqueue operation SIROCCO 2015Gadi Taubenfeld © 2015
13 Relaxing the enqueue operation SIROCCO 2015Gadi Taubenfeld © 2015
14 Relaxing the peek operation SIROCCO 2015Gadi Taubenfeld © 2015
15 Relaxing the peek operation SIROCCO 2015Gadi Taubenfeld © 2015
16 Relaxing the peek operation SIROCCO 2015Gadi Taubenfeld © 2015
17 Relaxing the peek operation SIROCCO 2015Gadi Taubenfeld © 2015
18 Relaxing the dequeue operation SIROCCO 2015Gadi Taubenfeld © 2015
19 Relaxing the dequeue operation SIROCCO 2015Gadi Taubenfeld © 2015
20 Relaxing the dequeue operation SIROCCO 2015Gadi Taubenfeld © 2015
21 Not supporting the dequeue operation SIROCCO 2015Gadi Taubenfeld © 2015
22 Not supporting the dequeue operation SIROCCO 2015Gadi Taubenfeld © 2015
23 Not supporting the dequeue operation SIROCCO 2015Gadi Taubenfeld © 2015
24 Atomic registers vs. relaxed queues SIROCCO 2015Gadi Taubenfeld © 2015
25 Atomic registers vs. relaxed queues Can atomic registers implement … ? SIROCCO 2015Gadi Taubenfeld © 2015
26 Atomic registers vs. relaxed queues No!!! Theorem: A queue[a,0,c] has no wait-free implementation from atomic registers, for every two positive integers a and c. Theorem: A queue[a,0,c] has no wait-free implementation from atomic registers, for every two positive integers a and c. SIROCCO 2015Gadi Taubenfeld © 2015
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 2015Gadi Taubenfeld © 2015
28 Thank you for listening SIROCCO 2015Gadi Taubenfeld © 2015