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.
- 2022. Java Platform Version 18 API Specification. https://docs.oracle.com/en/java/javase/18/docs/api/index.html
Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- James Aspnes, Maurice Herlihy, and Nir Shavit. 1994. Counting networks. JACM, 41, 5 (1994), https://doi.org/10.1145/185675.185815
Google Scholar
Digital Library
- Trevor Brown. 2018. Java Lock-Free Data Structure Library. https://bitbucket.org/trbot86/implementations/src/master/java/src/algorithms/published
Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Keir Fraser. 2004. Practical lock-freedom. Ph. D. Dissertation.
Google Scholar
- 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 Scholar
Cross Ref
- 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 Scholar
Digital Library
- Maurice Herlihy. 1991. Wait-free synchronization. TOPLAS, 13, 1 (1991), https://doi.org/10.1145/114005.102808
Google Scholar
Digital Library
- 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 Scholar
Cross Ref
- Maurice Herlihy and Nir Shavit. 2008. The art of multiprocessor programming. Morgan Kaufmann.
Google Scholar
- 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 Scholar
Digital Library
- Prasad Jayanti. 2005. An optimal multi-writer snapshot algorithm. In STOC. https://doi.org/10.1145/1060590.1060697
Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Doug Lea. 2004. The java concurrency package (JSR-166). http://gee.cs.oswego.edu/dl/concurrency-interest
Google Scholar
- Nancy A Lynch. 1996. Distributed algorithms. Elsevier.
Google Scholar
Digital Library
- Remigius Meier, Armin Rigo, and Thomas R Gross. 2016. Parallel virtual machines with RPython. In DLS. https://doi.org/10.1145/2989225.2989233
Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Cross Ref
- Gal Sela, Maurice Herlihy, and Erez Petrank. 2021. Brief announcement: Linearizability: A typo. In PODC. https://doi.org/10.1145/3465084.3467944
Google Scholar
Digital Library
- Gal Sela, Maurice Herlihy, and Erez Petrank. 2021. Linearizability: A typo. arXiv preprint, arxiv:2105.06737.
Google Scholar
- Gal Sela and Erez Petrank. 2022. Concurrent Size. arXiv preprint, arxiv:2209.07100.
Google Scholar
- Gal Sela and Erez Petrank. 2022. Concurrent Size - Artifact for OOPSLA’22. https://doi.org/10.5281/zenodo.7079982
Google Scholar
Digital Library
- Nir Shavit and Asaph Zemach. 1996. Diffracting trees. TOCS, 14, 4 (1996), https://doi.org/10.1145/235543.235546
Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Yuanhao Wei. 2021. vcaslib. https://github.com/yuanhaow/vcaslib
Google Scholar
- 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 Scholar
Digital Library
Index Terms
Concurrent size
Recommendations
Lock-Free Data-Structure Iterators
DISC 2013: Proceedings of the 27th International Symposium on Distributed Computing - Volume 8205Concurrent data structures are often used with large concurrent software. An iterator that traverses the data structure items is a highly desirable interface that often exists for sequential data structures but is missing from almost all concurrent data-...
Asynchronous Wait-Free Runtime Verification and Enforcement of Linearizability
PODC '23: Proceedings of the 2023 ACM Symposium on Principles of Distributed ComputingThis paper studies the problem of verifying linearizability at runtime, where one seeks for a concurrent algorithm for verifying that the current execution of a given concurrent shared object implementation is linearizable. It shows that it is ...






Comments