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

skip to main content
10.1145/2767386.2767436acmconferencesArticle/Chapter ViewAbstractPublication PagespodcConference Proceedingsconference-collections
research-article

Reclaiming Memory for Lock-Free Data Structures: There has to be a Better Way

Published: 21 July 2015 Publication History

Abstract

Memory reclamation for sequential or lock-based data structures is typically easy. However, memory reclamation for lock-free data structures is a significant challenge. Automatic techniques such as garbage collection are inefficient or use locks, and non-automatic techniques either have high overhead, or do not work for many reasonably simple data structures. For example, subtle problems can arise when hazard pointers, one of the most common non-automatic techniques, are applied to many natural lock-free data structures. Epoch based reclamation (EBR), which is by far the most efficient non-automatic technique, allows the number of unreclaimed objects to grow without bound, because one slow or crashed process can prevent all other processes from reclaiming memory. We develop a more efficient, distributed variant of EBR that solves this problem. It is based on signaling, which is provided by many operating systems, such as Linux and UNIX. Our new scheme takes O(1) amortized steps per high-level operation on the lock-free data structure and O(1) steps in the worst case each time an object is removed from the data structure. At any point, O(mn2) objects are waiting to be freed, where $n$ is the number of processes and m is a small constant for most data structures. Experiments show that our scheme has very low overhead: on average 10%, and at worst 28%, for a balanced binary search tree over many thread counts, operation mixes and contention levels. Our scheme also outperforms a highly efficient implementation of hazard pointers by an average of 75%.
Typically, memory reclamation code is tightly woven into lock-free data structure code. To improve modularity and facilitate the comparison of different memory reclamation schemes, we also introduce a highly flexible abstraction. It allows a programmer to easily interchange schemes for reclamation, object pooling, allocation and deallocation with virtually no overhead, by changing a single line of code.

References

[1]
Z. Aghazadeh, W. Golab, and P. Woelfel. Making objects writable. In Proceedings of the 2014 ACM symposium on Principles of distr. comp., pages 385--395. ACM, 2014.
[2]
D. Alistarh, P. Eugster, M. Herlihy, A. Matveev, and N. Shavit. Stacktrack: An automated transactional approach to concurrent memory reclamation. In Proceedings of the 9th European Conference on Comp. Sys., page 25. ACM, 2014.
[3]
A. Braginsky, A. Kogan, and E. Petrank. Drop the anchor: lightweight memory management for non-blocking data structures. In Proceedings of the 25th ACM symposium on Parallelism in alg. and arch., pages 33--42. ACM, 2013.
[4]
T. Brown, F. Ellen, and E. Ruppert. A general technique for non-blocking trees. In Proceedings of the 19th ACM SIGPLAN symposium on Principles and practice of parallel programming, pages 329--342. ACM, 2014.
[5]
T. Brown and J. Helga. Non-blocking k-ary search trees. In Principles of Distr. Sys., pages 207--221. Springer, 2011.
[6]
D. L. Detlefs, P. A. Martin, M. Moir, and G. L. Steele Jr. Lock-free reference counting. Distributed Computing, 15(4):255--271, 2002.
[7]
D. Drachsler, M. Vechev, and E. Yahav. Practical concurrent binary search trees via logical ordering. In Proceedings of the 19th annual ACM symposium on Principles and practice of parallel programming, pages 343--356. ACM, 2014.
[8]
A. Dragojević, M. Herlihy, Y. Lev, and M. Moir. On the power of hardware transactional memory to simplify memory management. In Proceedings of the 30th annual ACM SIGACT-SIGOPS symposium on Principles of distributed computing, pages 99--108. ACM, 2011.
[9]
F. Ellen, P. Fatourou, J. Helga, and E. Ruppert. The amortized complexity of non-blocking binary search trees. In Proc. of ACM Symp. on Princ. of Distr. Comp., PODC '14, pages 332--340, New York, NY, USA, 2014. ACM.
[10]
F. Ellen, P. Fatourou, E. Ruppert, and F. van Breugel. Non-blocking binary search trees. In Proceedings of the 29th ACM SIGACT-SIGOPS symposium on Principles of distributed computing, pages 131--140. ACM, 2010.
[11]
K. Fraser. Practical lock-freedom. PhD thesis, University of Cambridge, 2004.
[12]
A. Gidenstam, M. Papatriantafilou, H. Sundell, and P. Tsigas. Efficient and reliable lock-free memory reclamation based on reference counting. Parallel and Distributed Systems, IEEE Transactions on, 20(8):1173--1187, 2009.
[13]
T. E. Hart, P. E. McKenney, A. D. Brown, and J. Walpole. Performance of memory reclamation for lockless synchronization. Journal of Parallel and Distributed Computing, 67(12):1270--1285, 2007.
[14]
M. Herlihy. A methodology for implementing highly concurrent data objects. ACM Trans. Program. Lang. Syst., 15(5):745--770, Nov. 1993.
[15]
M. Herlihy, V. Luchangco, P. Martin, and M. Moir. Nonblocking memory management support for dynamic-sized data structures. ACM Transactions on Computer Systems (TOCS), 23(2):146--196, 2005.
[16]
R. Jones and R. Lins. Garbage collection: Algorithms for automatic dynamic memory management. John Wiliey & Sons Ltd., England, 1996.
[17]
H. Lee. Fast local-spin abortable mutual exclusion with bounded space. In Principles of Distributed Systems, pages 364--379. Springer, 2010.
[18]
A. Matveev. Private communication.
[19]
P. E. McKenney and J. D. Slingwine. Read-copy update: Using execution history to solve concurrency problems. In Parallel and Distr. Comp. and Sys., pages 509--518, 1998.
[20]
M. Michael. Hazard pointers: Safe memory reclamation for lock-free objects. Parallel and Distributed Systems, IEEE Transactions on, 15(6):491--504, 2004.
[21]
A. Natarajan and N. Mittal. Fast concurrent lock-free binary search trees. In Proceedings of the 19th annual ACM symposium on Principles and practice of parallel programming, pages 317--328. ACM, 2014.
[22]
M. Schoeberl and W. Puffitsch. Nonblocking real-time garbage collection. ACM Transactions on Embedded Computing Systems (TECS), 10(1):6, 2010.
[23]
N. Shafiei. Non-blocking patricia tries with replace operations. In Distributed Comp. Sys. (ICDCS), 2013 IEEE 33rd Int. Conf. on, pages 216--225. IEEE, 2013.
[24]
R. K. Treiber. Systems programming: Coping with parallelism. International Business Machines Incorporated, Thomas J. Watson Research Center, 1986.

Cited By

View all
  • (2024)A Family of Fast and Memory Efficient Lock- and Wait-Free ReclamationProceedings of the ACM on Programming Languages10.1145/36588518:PLDI(2174-2198)Online publication date: 20-Jun-2024
  • (2024)Concurrent Immediate Reference CountingProceedings of the ACM on Programming Languages10.1145/36563838:PLDI(151-174)Online publication date: 20-Jun-2024
  • (2024)Are Your Epochs Too Epic? Batch Free Can Be HarmfulProceedings of the 29th ACM SIGPLAN Annual Symposium on Principles and Practice of Parallel Programming10.1145/3627535.3638491(30-41)Online publication date: 2-Mar-2024
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
PODC '15: Proceedings of the 2015 ACM Symposium on Principles of Distributed Computing
July 2015
508 pages
ISBN:9781450336178
DOI:10.1145/2767386
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: 21 July 2015

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. epoch-based reclamation
  2. fault-tolerance
  3. hazard pointers
  4. lock-free
  5. memory reclamation
  6. non-blocking
  7. signals

Qualifiers

  • Research-article

Funding Sources

Conference

PODC '15
Sponsor:
PODC '15: ACM Symposium on Principles of Distributed Computing
July 21 - 23, 2015
Donostia-San Sebastián, Spain

Acceptance Rates

PODC '15 Paper Acceptance Rate 45 of 191 submissions, 24%;
Overall Acceptance Rate 740 of 2,477 submissions, 30%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)50
  • Downloads (Last 6 weeks)8
Reflects downloads up to 21 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2024)A Family of Fast and Memory Efficient Lock- and Wait-Free ReclamationProceedings of the ACM on Programming Languages10.1145/36588518:PLDI(2174-2198)Online publication date: 20-Jun-2024
  • (2024)Concurrent Immediate Reference CountingProceedings of the ACM on Programming Languages10.1145/36563838:PLDI(151-174)Online publication date: 20-Jun-2024
  • (2024)Are Your Epochs Too Epic? Batch Free Can Be HarmfulProceedings of the 29th ACM SIGPLAN Annual Symposium on Principles and Practice of Parallel Programming10.1145/3627535.3638491(30-41)Online publication date: 2-Mar-2024
  • (2024)Brief Announcement: A Fast Scalable Detectable Unrolled Lock-Based Linked ListProceedings of the 36th ACM Symposium on Parallelism in Algorithms and Architectures10.1145/3626183.3660272(73-75)Online publication date: 17-Jun-2024
  • (2024)Expediting Hazard Pointers with Bounded RCU Critical SectionsProceedings of the 36th ACM Symposium on Parallelism in Algorithms and Architectures10.1145/3626183.3659941(1-13)Online publication date: 17-Jun-2024
  • (2024)Simple, Fast and Widely Applicable Concurrent Memory Reclamation via NeutralizationIEEE Transactions on Parallel and Distributed Systems10.1109/TPDS.2023.333567135:2(203-220)Online publication date: Feb-2024
  • (2024)A Lock-free Binary Trie2024 IEEE 44th International Conference on Distributed Computing Systems (ICDCS)10.1109/ICDCS60910.2024.00024(163-174)Online publication date: 23-Jul-2024
  • (2024)A Fast Wait-Free Solution to Read-Reclaim Races in Reference CountingEuro-Par 2024: Parallel Processing10.1007/978-3-031-69583-4_8(103-118)Online publication date: 26-Aug-2024
  • (2024)Concurrent Wait-Free Graph Snapshots Using Multi-versioningNetworked Systems10.1007/978-3-031-67321-4_2(32-49)Online publication date: 25-Aug-2024
  • (2023)Modular Verification of Safe Memory Reclamation in Concurrent Separation LogicProceedings of the ACM on Programming Languages10.1145/36228277:OOPSLA2(828-856)Online publication date: 16-Oct-2023
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media