Skip to main content
Log in

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

  • Published:
Distributed Computing Aims and scope Submit manuscript

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11

Similar content being viewed by others

References

  1. Project Gutenberg. http://www.gutenberg.org/

  2. 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)

  3. 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)

  4. Aspnes, J., Censor, K.: Approximate shared-memory counting despite a strong adversary. ACM Trans. Algorithms 6(2), 25:1–25:23 (2010)

    Article  MathSciNet  Google Scholar 

  5. 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)

  6. Bagchi, A., Buchsbaum, A.L., Goodrich, M.T.: Biased skip lists. Algorithmica 42(1), 31–48 (2005)

    Article  MATH  MathSciNet  Google Scholar 

  7. 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)

  8. 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)

  9. 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)

  10. 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)

    Article  Google Scholar 

  11. The CAIDA UCSD Anonymized Internet Traces 2011 – 20110324. http://www.caida.org/data/passive/passive_2011_dataset.xml

  12. 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)

  13. 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)

  14. 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)

  15. 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)

  16. 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)

  17. Feigenbaum, J., Tarjan, R.E.: Two new kinds of biased search trees. Bell Syst. Tech. J. 62, 3139–3158 (1983)

    Article  MATH  MathSciNet  Google Scholar 

  18. 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)

  19. 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)

  20. 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)

  21. Herlihy, M.P., Wing, J.M.: Linearizability: a correctness condition for concurrent objects. ACM Trans. Program. Lang. Syst. (TOPLAS) 12, 463–492 (1990)

    Article  Google Scholar 

  22. Knuth, D.E.: The Art of Computer Programming, Volume 3: Sorting and Searching. Addison Wesley Longman Publishing Co. Inc., Redwood City, CA (1998)

    Google Scholar 

  23. Mahanti, A., Williamson, C., Eager, D.: Traffic analysis of a web proxy caching hierarchy. IEEE Netw. 14(3), 16–23 (2000)

    Article  Google Scholar 

  24. Mehlhorn, K.: Arbitrary weight changes in dynamic trees. RAIRO Theor. Inf. Appl. (Informatique Théorique et Applications) 15(3), 183–211 (1981)

    MATH  MathSciNet  Google Scholar 

  25. 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)

  26. 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)

  27. Pugh, W.: Skip lists: a probabilistic alternative to balanced trees. Commun. ACM 33, 668–676 (1990)

    Article  Google Scholar 

  28. Savochkin, A.V.: Linux inetpeer: storage for permanent information about peers. net/ipv4/inetpeer.c, Linux kernel source code (2013)

  29. Sedgewick, R.: Algorithms in C++, Parts 1–4: Fundamentals, Data Structure, Sorting, Searching, 3rd edn. Addison-Wesley Professional, Reading, MA (1998)

    Google Scholar 

  30. Seidel, R., Aragon, C.R.: Randomized search trees. Algorithmica 16, 464–497 (1996). doi:10.1007/s004539900061

    Article  MATH  MathSciNet  Google Scholar 

  31. Sleator, D.D.: Splay tree implementation. http://www.link.cs.cmu.edu/splay

  32. Sleator, D.D., Tarjan, R.E.: Self-adjusting binary search trees. J. ACM 32, 652–686 (1985)

    Article  MATH  MathSciNet  Google Scholar 

  33. Tarjan, R.E.: Amortized computational complexity. SIAM J. Algebraic Discret. Methods 6(2), 306–318 (1985)

    Article  MATH  MathSciNet  Google Scholar 

  34. 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)

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Adam Morrison.

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

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

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

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00446-014-0229-0

Keywords

Navigation