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.
Similar content being viewed by others
References
Project Gutenberg. http://www.gutenberg.org/
Afek, Y., Kaplan, H., Korenfeld, B., Morrison, A., Tarjan, R.E.: CBTree: a practical concurrent self-adjusting search tree. In: Proceedings of the 26th International Conference on Distributed Computing (DISC 2012), Volume 7611 of LNCS, pp. 1–15. Springer, Berlin (2012)
Aspnes, J., Attiya, H., Censor, K.: Max registers, counters, and monotone circuits. In: Proceedings of the 28th ACM Symposium on Principles of Distributed Computing. PODC ’09, pp. 36–45. ACM, New York, NY (2009)
Aspnes, J., Censor, K.: Approximate shared-memory counting despite a strong adversary. ACM Trans. Algorithms 6(2), 25:1–25:23 (2010)
Baer, J.-L.: Weight-balanced trees. In: American Federation of Information Processing Societies: 1975 National Computer Conference. AFIPS ’75, pp. 467–472. ACM, New York, NY (1975)
Bagchi, A., Buchsbaum, A.L., Goodrich, M.T.: Biased skip lists. Algorithmica 42(1), 31–48 (2005)
Bayer, R., Schkolnick, M.: Concurrency of operations on b-trees. In: Stonebraker, M. (ed.) Readings in Database Systems, pp. 129–139. Morgan Kaufmann Publishers Inc., San Francisco, CA (1988)
Bent, S.W., Sleator, D.D., Tarjan, R.E.: Biased 2–3 trees. In: Proceedings of the 21st Annual Symposium on Foundations of Computer Science. FOCS ’80, pp. 248–254. IEEE Computer Society, Washington, DC (1980)
Bronson, N.G., Casper, J., Chafi, H., Olukotun, K.: A practical concurrent binary search tree. In: Proceedings of the 15th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. PPoPP ’10, pp. 257–268. ACM, New York, NY (2010)
Cherkasova, L., Gupta, M.: Analysis of enterprise media server workloads: access patterns, locality, content evolution, and rates of change. IEEE/ACM Trans. Netw. 12(5), 781–794 (2004)
The CAIDA UCSD Anonymized Internet Traces 2011 – 20110324. http://www.caida.org/data/passive/passive_2011_dataset.xml
Crain, T., Gramoli, V., Raynal, M.: A speculation-friendly binary search tree. In: Proceedings of the 17th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. PPoPP ’12, pp. 161–170. ACM, New York, NY (2012)
Crain, T., Gramoli, V., Raynal, M.: A contention-friendly binary search tree. In: Proceedings of the 19th International European Conference on Parallel Processing. Euro-Par’13, pp. 229–240. Springer, Berlin (2013)
Crain, T., Gramoli, V., Raynal, M.: No hot spot non-blocking skip list. In: IEEE 33rd International Conference on Distributed Computing Systems (ICDCS), ICDCS’13, pp. 196–205 (2013)
Dice, D., Lev, Y., Moir, M.: Scalable statistics counters. In: Proceedings of the 25th ACM Symposium on Parallelism in Algorithms and Architectures. SPAA ’13, pp. 43–52. ACM, New York, NY (2013)
Ellen, F., Fatourou, P., Ruppert, E., van Breugel, F.: Non-blocking binary search trees. In: Proceedings of the 29th ACM SIGACT-SIGOPS Symposium on Principles of Distributed Computing. PODC ’10, pp. 131–140. ACM, New York, NY (2010)
Feigenbaum, J., Tarjan, R.E.: Two new kinds of biased search trees. Bell Syst. Tech. J. 62, 3139–3158 (1983)
Gill, P., Arlitt, M., Li, Z., Mahanti, A.: YouTube traffic characterization: a view from the edge. In: Proceedings of the 7th ACM SIGCOMM Conference on Internet Measurement. IMC ’07, pp. 15–28. ACM, New York, NY (2007)
Hanke, S., Ottmann, T., Soisalon-Soininen, E.: Relaxed balanced red-black trees. In: Proceedings of the 3rd Italian Conference on Algorithms and Complexity, pp. 193–204. Springer, Berlin (1997)
Herlihy, M., Lev, Y., Luchangco, V., Shavit, N.: A simple optimistic skiplist algorithm. In: Proceedings of the 14th International Conference on Structural Information and Communication Complexity. SIROCCO’07, pp. 124–138. Springer, Berlin (2007)
Herlihy, M.P., Wing, J.M.: Linearizability: a correctness condition for concurrent objects. ACM Trans. Program. Lang. Syst. (TOPLAS) 12, 463–492 (1990)
Knuth, D.E.: The Art of Computer Programming, Volume 3: Sorting and Searching. Addison Wesley Longman Publishing Co. Inc., Redwood City, CA (1998)
Mahanti, A., Williamson, C., Eager, D.: Traffic analysis of a web proxy caching hierarchy. IEEE Netw. 14(3), 16–23 (2000)
Mehlhorn, K.: Arbitrary weight changes in dynamic trees. RAIRO Theor. Inf. Appl. (Informatique Théorique et Applications) 15(3), 183–211 (1981)
Munro, Ian: J., Papadakis, T., Sedgewick, R.: Deterministic skip lists. In: Proceedings of the 3rd Annual ACM-SIAM Symposium on Discrete Algorithms. SODA ’92, pp. 367–375. Society for Industrial and Applied Mathematics, Philadelphia, PA (1992)
Nievergelt, J., Reingold, E.M.: Binary search trees of bounded balance. In: Proceedings of the Fourth Annual ACM symposium on Theory of Computing. STOC ’72, pp. 137–142. ACM, New York, NY (1972)
Pugh, W.: Skip lists: a probabilistic alternative to balanced trees. Commun. ACM 33, 668–676 (1990)
Savochkin, A.V.: Linux inetpeer: storage for permanent information about peers. net/ipv4/inetpeer.c, Linux kernel source code (2013)
Sedgewick, R.: Algorithms in C++, Parts 1–4: Fundamentals, Data Structure, Sorting, Searching, 3rd edn. Addison-Wesley Professional, Reading, MA (1998)
Seidel, R., Aragon, C.R.: Randomized search trees. Algorithmica 16, 464–497 (1996). doi:10.1007/s004539900061
Sleator, D.D.: Splay tree implementation. http://www.link.cs.cmu.edu/splay
Sleator, D.D., Tarjan, R.E.: Self-adjusting binary search trees. J. ACM 32, 652–686 (1985)
Tarjan, R.E.: Amortized computational complexity. SIAM J. Algebraic Discret. Methods 6(2), 306–318 (1985)
Zink, M., Suh, K., Gu, Y., Kurose, J.: Watch global, cache local: YouTube network traffic at a campus network: measurements and implications. In: Proceedings of the 15th SPIE/ACM Multimedia Computing and Networking Conference, 6818:28 (2008)
Author information
Authors and Affiliations
Corresponding author
Additional information
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.
Rights and permissions
About this article
Cite this article
Afek, Y., Kaplan, H., Korenfeld, B. et al. The CB tree: a practical concurrent self-adjusting search tree. Distrib. Comput. 27, 393–417 (2014). https://doi.org/10.1007/s00446-014-0229-0
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00446-014-0229-0