Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1145/3503221.3508433acmconferencesArticle/Chapter ViewAbstractPublication PagesppoppConference Proceedingsconference-collections
research-article
Public Access

Lock-free locks revisited

Published: 28 March 2022 Publication History

Abstract

This paper presents a new and practical approach to lock-free locks based on helping, which allows the user to write code using fine-grained locks, but run it in a lock-free manner. Although lock-free locks have been suggested in the past, they are widely viewed as impractical, have some key limitations, and, as far as we know, have never been implemented. The paper presents some key techniques that make lock-free locks practical and more general. The most important technique is an approach to idempotence---i.e. making code that runs multiple times appear as if it ran once. The idea is based on using a shared log among processes running the same protected code. Importantly, the approach can be library based, requiring very little if any change to standard code---code just needs to use the idempotent versions of memory operations (load, store, LL/SC, allocation, free).
We have implemented a C++ library called Flock based on the ideas. Flock allows lock-based data structures to run in either lock-free or blocking (traditional locks) mode. We implemented a variety of tree and list-based data structures with Flock and compare the performance of the lock-free and blocking modes under a variety of workloads. The lock-free mode is almost as fast as blocking mode under almost all workloads, and significantly faster when threads are over-subscribed (more threads than processors). We also compare with several existing lock-based and lock-free alternatives.

References

[1]
Maya Arbel-Raviv, Trevor Brown, and Adam Morrison. 2018. Getting to the Root of Concurrent Binary Search Tree Performance. In USENIX Annual Technical Conference. 295--306.
[2]
Hagit Attiya and Eshcar Hillel. 2013. Built-in coloring for highly-concurrent doubly-linked lists. Theory of Computing Systems 52, 4 (2013), 729--762.
[3]
Greg Barnes. 1993. A method for implementing lock-free shared-data structures. In ACM Symposium on Parallelism in Algorithms and Architectures (SPAA). 261--270.
[4]
R. Bayer and M. Schkolnick. 1988. Concurrency of Operations on B-Trees. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 129--139.
[5]
Naama Ben-David and Guy E. Blelloch. 2021. Fast and Fair Lock-Free Locks. arXiv:2108.04520 [cs.DC]
[6]
Naama Ben-David, Guy E. Blelloch, Panagiota Fatourou, Eric Ruppert, Yihan Sun, and Yuanhao Wei. 2021. Space and Time Bounded Multi-version Garbage Collection. In International Symposium on Distributed Computing (DISC). 12:1--12:20.
[7]
Naama Ben-David, Guy E Blelloch, Michal Friedman, and Yuanhao Wei. 2019. Delay-free concurrency on faulty persistent memory. In ACM Symposium on Parallelism in Algorithms and Architectures (SPAA). 253--264.
[8]
Naama Ben-David, Guy E. Blelloch, and Yuanhao Wei. 2022. Lock-Free Locks Revisited. arXiv:2201.00813 [cs.DC]
[9]
Guy E Blelloch, Daniel Anderson, and Laxman Dhulipala. 2020. ParlayLib-A toolkit for parallel algorithms on shared-memory multi-core machines. In ACM Symposium on Parallelism in Algorithms and Architectures (SPAA). 507--509.
[10]
Guy E Blelloch, Phillip B Gibbons, Yan Gu, Charles McGuffey, and Julian Shun. 2018. The parallel persistent memory model. In ACM Symposium on Parallelism in Algorithms and Architectures (SPAA). 247--258.
[11]
Nathan G. Bronson, Jared Casper, Hassan Chafi, and Kunle Olukotun. 2010. A Practical Concurrent Binary Search Tree. In ACM Symposium on Principles and Practice of Parallel Programming (PPOPP). 257--268.
[12]
Jeremy Brown, J. P. Grossman, and Tom Knight. 2002. A Lightweight Idempotent Messaging Protocol for Faulty Networks. In ACM Symposium on Parallelism in Algorithms and Architectures (SPAA). 248--257.
[13]
Trevor Brown, Faith Ellen, and Eric Ruppert. 2013. Pragmatic primitives for non-blocking data structures. In ACM Symposium on Principles of Distributed Computing (PODC). 13--22.
[14]
Trevor Brown, Faith Ellen, and Eric Ruppert. 2014. A general technique for non-blocking trees. In ACM Symposium on Principles and Practice of Parallel Programming (PPOPP). 329--342.
[15]
Keren Censor-Hillel, Erez Petrank, and Shahar Timnat. 2015. Help!. In ACM Symposium on Principles of Distributed Computing (PODC). 241--250.
[16]
Brian F Cooper, Adam Silberstein, Erwin Tam, Raghu Ramakrishnan, and Russell Sears. 2010. Benchmarking cloud serving systems with YCSB. In Proceedings of the 1st ACM symposium on Cloud computing. 143--154.
[17]
Tudor David, Rachid Guerraoui, and Vasileios Trigonakis. 2015. Asynchronized Concurrency: The Secret to Scaling Concurrent Search Data Structures. In International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS).
[18]
Marc de Kruijf and Karthikeyan Sankaralingam. 2013. Idempotent Code Generation: Implementation, Analysis, and Evaluation. In IEEE/ACM International Symposium on Code Generation and Optimization (CGO).
[19]
Marc A. de Kruijf, Karthikeyan Sankaralingam, and Somesh Jha. 2012. Static Analysis and Compiler Design for Idempotent Processing. In ACM Conference on Programming Language Design and Implementation (PLDI).
[20]
Dave Dice and Alex Garthwaite. 2002. Mostly lock-free malloc. In International Symposium on Memory Management (ISMM). 163--174.
[21]
Dana Drachsler, Martin Vechev, and Eran Yahav. 2014. Practical Concurrent Binary Search Trees via Logical Ordering. In ACM Symposium on Principles and Practice of Parallel Programming (PPOPP).
[22]
Faith Ellen, Panagiota Fatourou, Eric Ruppert, and Franck van Breugel. 2010. Non-blocking binary search trees. In ACM Symposium on Principles of Distributed Computing (PODC).
[23]
Steven Feldman, Pierre LaBorde, and Damian Dechev. 2015. A wait-free multi-word compare-and-swap operation. International Journal of Parallel Programming 43, 4 (2015), 572--596.
[24]
Keir Fraser. 2004. Practical lock-freedom. Technical Report. University of Cambridge, Computer Laboratory.
[25]
Keir Fraser and Tim Harris. 2007. Concurrent programming without locks. ACM Transactions on Computer Systems (TOCS) 25, 2 (2007), 5--es.
[26]
Anders Gidenstam and Marina Papatriantafilou. 2007. LFthreads: A Lock-Free Thread Library. In Conf. on Principles of Distributed Systems (OPODIS).
[27]
Michael Greenwald. 2002. Two-handed emulation: how to build non-blocking implementations of complex data-structures using DCAS. In ACM Symposium on Principles of Distributed Computing (PODC). 260--269.
[28]
Rachid Guerraoui, Alex Kogan, Virendra J Marathe, and Igor Zablotchi. 2020. Efficient multi-word compare and swap. International Symposium on Distributed Computing (DISC).
[29]
D. Guniguntala, P. E. McKenney, J. Triplett, and J. Walpole. 2008. The read-copy-update mechanism for supporting real-time applications on shared-memory multiprocessor systems with Linux. IBM Systems Journal 47, 2 (2008), 221--236.
[30]
Timothy L Harris. 2001. A pragmatic implementation of non-blocking linked-lists. In International Symposium on Distributed Computing (DISC). Springer, 300--314.
[31]
Timothy L Harris, Keir Fraser, and Ian A Pratt. 2002. A practical multiword compare-and-swap operation. In International Symposium on Distributed Computing (DISC). 265--279.
[32]
Steve Heller, Maurice Herlihy, Victor Luchangco, Mark Moir, William N. Scherer, and Nir Shavit. 2006. A Lazy Concurrent List-Based Set Algorithm. In Conf. on Principles of Distributed Systems (OPODIS).
[33]
Maurice Herlihy. 1991. Wait-Free Synchronization. ACM Transactions on Programming Languages and Systems (TOPLAS) 13, 1 (jan 1991), 124--149.
[34]
Peter Zilahy Ingerman. 1961. Thunks: a way of compiling procedure statements with some comments on procedure declarations. Commun. ACM 4, 1 (1961), 55--58.
[35]
Seon Wook Kim, Chong-Liang Ooi, Rudolf Eigenmann, Babak Falsafi, and T. N. Vijaykumar. 2006. Exploiting Reference Idempotency to Reduce Speculative Storage Overflow. ACM Transactions on Programming Languages and Systems (TOPLAS) 28, 5 (sep 2006), 942--965.
[36]
H. T. Kung and Philip L. Lehman. 1980. Concurrent Manipulation of Binary Search Trees. ACM Trans. Database Syst. 5, 3 (1980).
[37]
H. T. Kung and John T. Robinson. 1981. On Optimistic Methods for Concurrency Control. ACM Trans. Database Syst. 6, 2 (1981), 213--226.
[38]
Viktor Leis, Alfons Kemper, and Thomas Neumann. 2013. The Adaptive Radix Tree: ARTful Indexing for Main-Memory Databases. In IEEE International Conference on Data Engineering (ICDE).
[39]
Viktor Leis, Florian Scheibner, Alfons Kemper, and Thomas Neumann. 2016. The ART of Practical Synchronization. In Proc. International Workshop on Data Management on New Hardware.
[40]
Brandon Lucia and Benjamin Ransford. 2015. A simpler, safer programming and execution model for intermittent systems. In ACM Conference on Programming Language Design and Implementation (PLDI).
[41]
Yandong Mao, Eddie Kohler, and Robert Tappan Morris. 2012. Cache Craftiness for Fast Multicore Key-Value Storage. In ACM European Conference on Computer Systems (EuroSys).
[42]
Maged M Michael and Michael L Scott. 1996. Simple, fast, and practical non-blocking and blocking concurrent queue algorithms. In ACM Symposium on Principles of Distributed Computing (PODC). 267--275.
[43]
Aravind Natarajan and Neeraj Mittal. 2014. Fast Concurrent Lock-Free Binary Search Trees. In ACM Symposium on Principles and Practice of Parallel Programming (PPOPP).
[44]
William Pugh. 1989. Concurrent Maintenance of Skip Lists. Technical Report TR-CS-2222. Dept. of Computer Science, University of Maryland, College Park.
[45]
Ravi Rajwar and James R. Goodman. 2002. Transactional lock-free execution of lock-based programs. In International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS). ACM Press, 5--17.
[46]
Pedro Ramalhete, Andreia Correia, Pascal Felber, and Nachshon Cohen. 2019. OneFile: A wait-free persistent transactional memory. In IEEE/IFIP International Conference on Dependable Systems and Networks (DSN). 151--163.
[47]
Niloufar Shafiei. 2014. Non-Blocking Doubly-Linked Lists with Good Amortized Complexity. arXiv:1408.1935 [cs.DC]
[48]
Nir Shavit and Dan Touitou. 1997. Software transactional memory. Distributed Computing 10, 2 (1997), 99--116.
[49]
Anubhav Srivastava. 2021. Extremely fast (a, b)-trees at all contention levels. Master's thesis. University of Waterloo.
[50]
Håkan Sundell and Philippas Tsigas. 2008. Lock-free deques and doubly linked lists. J. Parallel and Distributed Computing 68, 7 (2008), 1008--1020.
[51]
Shahar Timnat and Erez Petrank. 2014. A practical wait-free simulation for lock-free data structures. ACM Symposium on Principles and Practice of Parallel Programming (PPOPP) 49, 8 (2014), 357--368.
[52]
John Turek, Dennis Shasha, and Sundeep Prakash. 1992. Locking without blocking: making lock based concurrent data structure algorithms nonblocking. In Principles of Database Systems (PODS). 212--222.
[53]
Tianzheng Wang, Justin Levandoski, and Per-Ake Larson. 2018. Easy lock-free indexing in non-volatile memory. In IEEE International Conference on Data Engineering (ICDE). IEEE, 461--472.
[54]
Ziqi Wang, Andrew Pavlo, Hyeontaek Lim, Viktor Leis, Huanchen Zhang, Michael Kaminsky, and David Andersen. 2018. Building a Bw-Tree Takes More Than Just Buzz Words. ACM SIGMOD International Conference on Management of Data (SIGMOD), 473--488.
[55]
Kjell Winblad, Konstantinos Sagonas, and Bengt Jonsson. 2021. Lock-free contention adapting search trees. ACM Transactions on Parallel Computing (TOPC) 8, 2 (2021), 1--38.

Cited By

View all
  • (2023)Separating Mechanism from Policy in STMProceedings of the 32nd International Conference on Parallel Architectures and Compilation Techniques10.1109/PACT58117.2023.00031(279-296)Online publication date: 21-Oct-2023
  • (2022)Fast and Fair Randomized Wait-Free LocksProceedings of the 2022 ACM Symposium on Principles of Distributed Computing10.1145/3519270.3538448(187-197)Online publication date: 20-Jul-2022

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
PPoPP '22: Proceedings of the 27th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming
April 2022
495 pages
ISBN:9781450392044
DOI:10.1145/3503221
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 28 March 2022

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. idempotence
  2. lock-free data structures
  3. locks

Qualifiers

  • Research-article

Funding Sources

Conference

PPoPP '22

Acceptance Rates

Overall Acceptance Rate 230 of 1,014 submissions, 23%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)620
  • Downloads (Last 6 weeks)86
Reflects downloads up to 23 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2023)Separating Mechanism from Policy in STMProceedings of the 32nd International Conference on Parallel Architectures and Compilation Techniques10.1109/PACT58117.2023.00031(279-296)Online publication date: 21-Oct-2023
  • (2022)Fast and Fair Randomized Wait-Free LocksProceedings of the 2022 ACM Symposium on Principles of Distributed Computing10.1145/3519270.3538448(187-197)Online publication date: 20-Jul-2022

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media