The Computability of Relaxed Data Structures Queues and
The Computability of Relaxed Data Structures: Queues and Stacks as Examples Nir Shavit and Gadi Taubenfeld Version: August 2015 SIROCCO 2015 Gadi Taubenfeld © 2015 1
relaxed Semantics of concurrent data structures Ø Sequential specification -set of legal runs/sequences. This paper Ø Consistency condition -e. g. linearizability, sequential consistency, … SIROCCO 2015 Gadi Taubenfeld © 2015 2
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 3
Queue[a, b, c] peek c a enqueue b dequeue Ø * -- can insert/remove/return a value at arbitrary position Ø 0 -- operation not supported SIROCCO 2015 Gadi Taubenfeld © 2015 4
Stack[a, b, c] top c SIROCCO 2015 a b push pop Gadi Taubenfeld © 2015 5
enqueue dequeue peek Queue[a, b, c] Ø Queue[1, 1, 1] -- traditional FIFO queue Ø Queue[1, 1, 0] -- does not support peek Ø Queue[1, 1, *] -- peek returns a random value Ø Queue[*, *, 0] = Stack[*, *, 0] -- multiset object Ø Stack[ 1, 0, 1] -- atomic read/write register SIROCCO 2015 Gadi Taubenfeld © 2015 6
Consensus Number known results Object Consensus number queue[1, 1, 1] queue[*, *, 0], queue[1, 1, 0] 2 stack[*, *, 0], stack[1, 1, 1] 2 atomic register, stack[1, 0, 1] 1 Ø Objects are wait-free & linearizable SIROCCO 2015 Gadi Taubenfeld © 2015 7
Relaxing the enqueue operation SIROCCO 2015 Gadi Taubenfeld © 2015 8
Relaxing the enqueue operation Object 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] SIROCCO 2015 2 Gadi Taubenfeld © 2015 9
Relaxing the enqueue operation Object Consensus number queue[1, 1, 1] queue[2, 1, 1] queue[3, 1, 1] … queue[*, 1, 1] 2 queue[*, 2, 1] queue[*, 3, 1] … queue[*, *, 1] queue[*, *, 2] queue[*, *, 0] SIROCCO 2015 2 Gadi Taubenfeld © 2015 10
Relaxing the enqueue operation Object Consensus number queue[1, 1, 1] queue[2, 1, 1] queue[3, 1, 1] … queue[*, 1, 1] 2 queue[*, 2, 1] 2 queue[*, 3, 1] 2 … 2 queue[*, *, 1] 2 queue[*, *, 2] 2 2 queue[*, *, 0] SIROCCO 2015 2 Gadi Taubenfeld © 2015 11
Relaxing the enqueue operation Object Consensus number queue[1, 1, 1] queue[2, 1, 1] queue[3, 1, 1] … queue[*, 1, 1] 2 queue[*, 2, 1] 2 queue[*, 3, 1] 2 … 2 queue[*, *, 1] 2 queue[*, *, 2] 2 2 queue[*, *, 0] SIROCCO 2015 2 Gadi Taubenfeld © 2015 12
Relaxing the enqueue operation Object queue[1, 1, 1], Consensus number queue[1, 0, 1] queue[2, 1, 1], queue[2, 0, 1] queue[3, 1, 1], queue[3, 0, 1] … … queue[*, 1, 1] 2 queue[*, 2, 1] 2 queue[*, 3, 1] 2 … 2 queue[*, *, 1] 2 queue[*, *, 2] 2 2 queue[*, *, 0] SIROCCO 2015 2 Gadi Taubenfeld © 2015 13
Relaxing the peek operation SIROCCO 2015 Gadi Taubenfeld © 2015 14
Relaxing the peek operation Object 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] SIROCCO 2015 2 Gadi Taubenfeld © 2015 15
Relaxing the peek operation Object Consensus number queue[1, 1, 1] queue[1, 1, 2] 2 queue[1, 1, 3] … queue[1, 1, *] queue[1, 2, *] queue[1, 3, *] … queue[1, *, *] queue[2, *, *] queue[*, *, 0] SIROCCO 2015 2 Gadi Taubenfeld © 2015 16
Relaxing the peek operation Object Consensus number queue[1, 1, 1] queue[1, 1, 2] 2 queue[1, 1, 3] 2 … 2 queue[1, 1, *] 2 queue[1, 2, *] 2 queue[1, 3, *] 2 … 2 queue[1, *, *] 2 queue[2, *, *] 2 2 queue[*, *, 0] SIROCCO 2015 2 Gadi Taubenfeld © 2015 17
Relaxing the dequeue operation SIROCCO 2015 Gadi Taubenfeld © 2015 18
Relaxing the dequeue operation Object Consensus number queue[1, 1, 1], queue[1, 0, 1] queue[1, 1, 2] 2 queue[1, 2, 2] … queue[1, *, 2] queue[1, *, 3] queue[1, *, 4] … queue[1, *, *] queue[2, *, *] queue[*, *, 0] SIROCCO 2015 2 Gadi Taubenfeld © 2015 19
Relaxing the dequeue operation Object Consensus number queue[1, 1, 1], queue[1, 0, 1] queue[1, 1, 2] 2 queue[1, 2, 2] 2 … 2 queue[1, *, 2] 2 queue[1, *, 3] 2 queue[1, *, 4] 2 … 2 queue[1, *, *] 2 queue[2, *, *] 2 2 queue[*, *, 0] SIROCCO 2015 2 Gadi Taubenfeld © 2015 20
Not supporting the dequeue operation Object Consensus number queue[1, 1, 1], queue[1, 0, 1] queue[1, 1, 2] 2 queue[1, 0, 2] queue[2, 0, 2] queue[3, 0, 2] … queue[*, 0, 2] queue[0, 0, 2] SIROCCO 2015 1 Gadi Taubenfeld © 2015 21
Not supporting the dequeue operation Object Consensus number queue[1, 1, 1], queue[1, 0, 1] queue[1, 1, 2] 2 queue[1, 0, 2] 1 queue[2, 0, 2] queue[3, 0, 2] … queue[*, 0, 2] queue[0, 0, 2] SIROCCO 2015 1 Gadi Taubenfeld © 2015 22
Not supporting the dequeue operation SIROCCO 2015 Object Consensus number queue[1, 1, 1], queue[1, 0, 1] queue[1, 1, 2] 2 queue[1, 0, 2] 1 queue[2, 0, 2] 1 queue[3, 0, 2] 1 … 1 queue[*, 0, 2] 1 queue[0, 0, 2] 1 Gadi Taubenfeld © 2015 23
Atomic registers vs. relaxed queues SIROCCO 2015 Gadi Taubenfeld © 2015 24
Atomic registers vs. relaxed queues yes Object Consensus number queue[1, 1, 1], queue[1, 0, 1] queue[1, 1, 2] 2 queue[1, 0, 2] 1 queue[2, 0, 2] 1 queue[3, 0, 2] 1 … 1 queue[*, 0, 2] 1 Atomic registers 1 ? ? ? Can atomic registers implement … ? SIROCCO 2015 Gadi Taubenfeld © 2015 25
Atomic registers vs. relaxed queues yes Object Consensus number queue[1, 1, 1], queue[1, 0, 1] queue[1, 1, 2] 2 queue[1, 0, 2] 1 queue[2, 0, 2] 1 queue[3, 0, 2] 1 … 1 queue[*, 0, 2] 1 Atomic registers 1 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 26
Discussion q Each one of the infinitely many relaxed objects has one of the following consensus numbers: 1, 2, . Why only three? q Queue is more sensitive than stack to changes in its semantics. q Consider other types of relaxed data structures. q 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 27
Thank you for listening SIROCCO 2015 Gadi Taubenfeld © 2015 28
- Slides: 28