Relativistic Red-Black Trees
Philip W. Howard, Jonathan Walpole, October 2013.
- Presented by Kendall Stewart
Relativistic Red-Black Trees Philip W. Howard, Jonathan Walpole, - - PowerPoint PPT Presentation
Relativistic Red-Black Trees Philip W. Howard, Jonathan Walpole, October 2013. Presented by Kendall Stewart CS510 Concurrent Systems, Spring 2014 The Story so Far Locking is slow Non-blocking algorithms are complicated Memory
Read-Copy Update Relativistic Programming spin_lock spin_unlock write-lock write-unlock rcu_read_lock rcu_read_unlock start-read end-read rcu_assign_pointer rcu_dereference rp-publish rp-read synchronize_rcu wait-for-readers call_rcu(kfree, …) rp-free
D = C.next rp-publish(B.next, D) rp-free(C)
C’ = copy(C) C’.next = B rp-publish(A.next, C’) rp-publish(B.next, D) rp-free(C)
What if a reader was at B the whole time? That reader will miss C!
C’ = copy(C) C’.next = B rp-publish(A.next, C’) wait-for-readers() rp-publish(B.next, D) rp-free(C)
C could not be removed until its copy was in place, because otherwise some readers might have missed the value of C.
(waiting for existing readers).
at C before the removal takes effect.
data type implemented by the list.
C to a position later in the list — some readers would simply be guaranteed to see the value of C twice.
the traversal pattern guarantee an ordering for free.
might expect) and fine-grained locking (susceptible to deadlock)
parent pointer.
key is associated with exactly one value — so readers can stop searching once they find the key they’re looking for.
that all potential readers can find at least one of the copies.
Reader Reader Reader
its collection.
To remove B, where next node is right child:
duplicate nodes are okay — so these are properties of relativistic red- black trees implementing a particular ADT, not of relativistic red-black trees in general.
unreachable — wait-for-readers ensures no inconsistent state is visible
down the tree
pointers, and therefore don’t take traversal patterns into account — this means that traversing readers may miss some nodes, or report duplicates
relativistic reads for traversals
lookup of every node
O(N) traversals
linked list traversal!
scales linearly