Distributed Computing

, Volume 27, Issue 6, pp 393–417 | Cite as

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

  • Yehuda Afek
  • Haim Kaplan
  • Boris Korenfeld
  • Adam Morrison
  • Robert E. Tarjan
Article

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 

References

  1. 1.
    Project Gutenberg. http://www.gutenberg.org/
  2. 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)Google Scholar
  3. 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)Google Scholar
  4. 4.
    Aspnes, J., Censor, K.: Approximate shared-memory counting despite a strong adversary. ACM Trans. Algorithms 6(2), 25:1–25:23 (2010)CrossRefMathSciNetGoogle Scholar
  5. 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)Google Scholar
  6. 6.
    Bagchi, A., Buchsbaum, A.L., Goodrich, M.T.: Biased skip lists. Algorithmica 42(1), 31–48 (2005)CrossRefMATHMathSciNetGoogle Scholar
  7. 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)Google Scholar
  8. 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)Google Scholar
  9. 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)Google Scholar
  10. 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)CrossRefGoogle Scholar
  11. 11.
    The CAIDA UCSD Anonymized Internet Traces 2011 – 20110324. http://www.caida.org/data/passive/passive_2011_dataset.xml
  12. 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)Google Scholar
  13. 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)Google Scholar
  14. 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)Google Scholar
  15. 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)Google Scholar
  16. 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)Google Scholar
  17. 17.
    Feigenbaum, J., Tarjan, R.E.: Two new kinds of biased search trees. Bell Syst. Tech. J. 62, 3139–3158 (1983)CrossRefMATHMathSciNetGoogle Scholar
  18. 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)Google Scholar
  19. 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) Google Scholar
  20. 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)Google Scholar
  21. 21.
    Herlihy, M.P., Wing, J.M.: Linearizability: a correctness condition for concurrent objects. ACM Trans. Program. Lang. Syst. (TOPLAS) 12, 463–492 (1990)CrossRefGoogle Scholar
  22. 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. 23.
    Mahanti, A., Williamson, C., Eager, D.: Traffic analysis of a web proxy caching hierarchy. IEEE Netw. 14(3), 16–23 (2000)CrossRefGoogle Scholar
  24. 24.
    Mehlhorn, K.: Arbitrary weight changes in dynamic trees. RAIRO Theor. Inf. Appl. (Informatique Théorique et Applications) 15(3), 183–211 (1981)MATHMathSciNetGoogle Scholar
  25. 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)Google Scholar
  26. 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)Google Scholar
  27. 27.
    Pugh, W.: Skip lists: a probabilistic alternative to balanced trees. Commun. ACM 33, 668–676 (1990)CrossRefGoogle Scholar
  28. 28.
    Savochkin, A.V.: Linux inetpeer: storage for permanent information about peers. net/ipv4/inetpeer.c, Linux kernel source code (2013)Google Scholar
  29. 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. 30.
    Seidel, R., Aragon, C.R.: Randomized search trees. Algorithmica 16, 464–497 (1996). doi:10.1007/s004539900061 CrossRefMATHMathSciNetGoogle Scholar
  31. 31.
    Sleator, D.D.: Splay tree implementation. http://www.link.cs.cmu.edu/splay
  32. 32.
    Sleator, D.D., Tarjan, R.E.: Self-adjusting binary search trees. J. ACM 32, 652–686 (1985)CrossRefMATHMathSciNetGoogle Scholar
  33. 33.
    Tarjan, R.E.: Amortized computational complexity. SIAM J. Algebraic Discret. Methods 6(2), 306–318 (1985)CrossRefMATHMathSciNetGoogle Scholar
  34. 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)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2014

Authors and Affiliations

  • Yehuda Afek
    • 1
  • Haim Kaplan
    • 1
  • Boris Korenfeld
    • 1
  • Adam Morrison
    • 1
  • Robert E. Tarjan
    • 2
    • 3
  1. 1.Blavatnik School of Computer ScienceTel Aviv UniversityTel AvivIsrael
  2. 2.Department of Computer SciencePrinceton UniversityPrincetonUSA
  3. 3.Microsoft ResearchMountain ViewUSA

Personalised recommendations