The CB tree: a practical concurrent self-adjusting search tree

Abstract

We present the CB tree, a counting-based self-adjusting binary search tree in which, as in splay trees, more-frequently accessed items move closer to the root. In a sequential execution, after \(m\) operations of which \(c(v)\) access item \(v\), an access of \(v\) traverses a path of length \(\mathcal {O}\left( 1 + \log \frac{m}{c(v)}\right) \) while doing few if any rotations. Unlike the original splay tree, in which each access moves the accessed item all the way to the root via a sequence of rotations, accesses in a CB tree do very few rotations, specifically \(\mathcal {O}\left( n + n\log \frac{m}{n}\right) \), during a sequence of \(m\) operations of which \(n\) are insertions. This is \(o(1)\) (subconstant) amortized per operation if \(m \gg n\). We adapt the CB tree into a scalable concurrent self-adjusting BST. We show experimentally that the concurrent CB tree scales well because it, too, performs few rotations, and therefore self-adjusts without having rotations create a bottleneck. Our evaluation shows that the concurrent CB tree performs better than existing concurrent search trees on non-uniform access sequences derived from real workloads.

Keywords

Self-adjusting tree Splay tree Optimistic concurrency control

A preliminary version of this paper appeared in the proceedings of the 26th International Symposium on Distributed Computing (DISC 2012) [2].

This work was supported by the Israel Science Foundation under Grants 1386/11 and 822-10, by the Israeli Centers of Research Excellence (I-CORE) program (Center 4/11), and by the BSF. Robert E. Tarjan’s work is partially supported by NSF Grant CCF-0832797.