skip to main content

Concurrent size

Published:31 October 2022Publication History
Skip Abstract Section

Abstract

The size of a data structure (i.e., the number of elements in it) is a widely used property of a data set. However, for concurrent programs, obtaining a correct size efficiently is non-trivial. In fact, the literature does not offer a mechanism to obtain a correct (linearizable) size of a concurrent data set without resorting to inefficient solutions, such as taking a full snapshot of the data structure to count the elements, or acquiring one global lock in all update and size operations. This paper presents a methodology for adding a concurrent linearizable size operation to sets and dictionaries with a relatively low performance overhead. Theoretically, the proposed size operation is wait-free with asymptotic complexity linear in the number of threads (independently of data-structure size). Practically, we evaluated the performance overhead by adding size to various concurrent data structures in Java−a skip list, a hash table and a tree. The proposed linearizable size operation executes faster by orders of magnitude compared to the existing option of taking a snapshot, while incurring a throughput loss of 1%−20% on the original data structure’s operations.

References

  1. 2022. Java Platform Version 18 API Specification. https://docs.oracle.com/en/java/javase/18/docs/api/index.html Google ScholarGoogle Scholar
  2. Yehuda Afek, Hagit Attiya, Danny Dolev, Eli Gafni, Michael Merritt, and Nir Shavit. 1993. Atomic snapshots of shared memory. JACM, 40, 4 (1993), https://doi.org/10.1145/153724.153741 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Yehuda Afek, Nir Shavit, and Moran Tzafrir. 2012. Interrupting snapshots and the Java™ size method. J. Parallel and Distrib. Comput., 72, 7 (2012), https://doi.org/10.1016/j.jpdc.2012.03.007 Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Maya Arbel-Raviv and Trevor Brown. 2018. Harnessing epoch-based reclamation for efficient range queries. In PPoPP. https://doi.org/10.1145/3178487.3178489 Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. James Aspnes, Maurice Herlihy, and Nir Shavit. 1994. Counting networks. JACM, 41, 5 (1994), https://doi.org/10.1145/185675.185815 Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Trevor Brown. 2018. Java Lock-Free Data Structure Library. https://bitbucket.org/trbot86/implementations/src/master/java/src/algorithms/published Google ScholarGoogle Scholar
  7. Brian F Cooper, Adam Silberstein, Erwin Tam, Raghu Ramakrishnan, and Russell Sears. 2010. Benchmarking cloud serving systems with YCSB. In SoCC. https://doi.org/10.1145/1807128.1807152 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Benoit Daloze, Arie Tal, Stefan Marr, Hanspeter Mössenböck, and Erez Petrank. 2018. Parallelization of dynamic languages: synchronizing built-in collections. Proceedings of the ACM on Programming Languages, 2, OOPSLA (2018), https://doi.org/10.1145/3276478 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Faith Ellen, Panagiota Fatourou, Eric Ruppert, and Franck van Breugel. 2010. Non-blocking binary search trees. In PODC. https://doi.org/10.1145/1835698.1835736 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Keir Fraser. 2004. Practical lock-freedom. Ph. D. Dissertation. Google ScholarGoogle Scholar
  11. Timothy L Harris. 2001. A pragmatic implementation of non-blocking linked-lists. In DISC. https://doi.org/10.1007/3-540-45414-4_21 Google ScholarGoogle ScholarCross RefCross Ref
  12. Steve Heller, Maurice Herlihy, Victor Luchangco, Mark Moir, William N Scherer, and Nir Shavit. 2005. A lazy concurrent list-based set algorithm. In OPODIS. https://doi.org/10.1007/11795490_3 Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Maurice Herlihy. 1991. Wait-free synchronization. TOPLAS, 13, 1 (1991), https://doi.org/10.1145/114005.102808 Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Maurice Herlihy, Yossi Lev, Victor Luchangco, and Nir Shavit. 2007. A simple optimistic skiplist algorithm. In SIROCCO. https://doi.org/10.1007/978-3-540-72951-8_11 Google ScholarGoogle ScholarCross RefCross Ref
  15. Maurice Herlihy and Nir Shavit. 2008. The art of multiprocessor programming. Morgan Kaufmann. Google ScholarGoogle Scholar
  16. Maurice Herlihy and Jeannette M. Wing. 1990. Linearizability: A correctness condition for concurrent objects. TOPLAS, 12, 3 (1990), https://doi.org/10.1145/78969.78972 Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Prasad Jayanti. 2005. An optimal multi-writer snapshot algorithm. In STOC. https://doi.org/10.1145/1060590.1060697 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Leslie Lamport. 1979. How to make a multiprocessor computer that correctly executes multiprocess programs. IEEE Trans. Comput., 28, 9 (1979), https://doi.org/10.1109/TC.1979.1675439 Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Doug Lea. 2004. The java concurrency package (JSR-166). http://gee.cs.oswego.edu/dl/concurrency-interest Google ScholarGoogle Scholar
  20. Nancy A Lynch. 1996. Distributed algorithms. Elsevier. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Remigius Meier, Armin Rigo, and Thomas R Gross. 2016. Parallel virtual machines with RPython. In DLS. https://doi.org/10.1145/2989225.2989233 Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Jacob Nelson-Slivon, Ahmed Hassan, and Roberto Palmieri. 2022. Bundling linked data structures for linearizable range queries. In PPoPP. https://doi.org/10.1145/3503221.3508412 Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Erez Petrank and Shahar Timnat. 2013. Lock-free data-structure iterators. In DISC. https://doi.org/10.1007/978-3-642-41527-2_16 Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Yaron Riany, Nir Shavit, and Dan Touitou. 2001. Towards a practical snapshot algorithm. Theoretical Computer Science, 269, 1-2 (2001), https://doi.org/10.1016/S0304-3975(00)00412-6 Google ScholarGoogle ScholarCross RefCross Ref
  25. Gal Sela, Maurice Herlihy, and Erez Petrank. 2021. Brief announcement: Linearizability: A typo. In PODC. https://doi.org/10.1145/3465084.3467944 Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Gal Sela, Maurice Herlihy, and Erez Petrank. 2021. Linearizability: A typo. arXiv preprint, arxiv:2105.06737. Google ScholarGoogle Scholar
  27. Gal Sela and Erez Petrank. 2022. Concurrent Size. arXiv preprint, arxiv:2209.07100. Google ScholarGoogle Scholar
  28. Gal Sela and Erez Petrank. 2022. Concurrent Size - Artifact for OOPSLA’22. https://doi.org/10.5281/zenodo.7079982 Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Nir Shavit and Asaph Zemach. 1996. Diffracting trees. TOCS, 14, 4 (1996), https://doi.org/10.1145/235543.235546 Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Håkan Sundell and Philippas Tsigas. 2005. Fast and lock-free concurrent priority queues for multi-thread systems. J. Parallel and Distrib. Comput., 65, 5 (2005), https://doi.org/10.1016/j.jpdc.2004.12.005 Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Yuanhao Wei. 2021. vcaslib. https://github.com/yuanhaow/vcaslib Google ScholarGoogle Scholar
  32. Yuanhao Wei, Naama Ben-David, Guy E Blelloch, Panagiota Fatourou, Eric Ruppert, and Yihan Sun. 2021. Constant-time snapshots with applications to concurrent data structures. In PPoPP. https://doi.org/10.1145/3437801.3441602 Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Concurrent size

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Article Metrics

          • Downloads (Last 12 months)175
          • Downloads (Last 6 weeks)21

          Other Metrics

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!