Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

ThreadScan: Automatic and Scalable Memory Reclamation

Published: 01 May 2018 Publication History
  • Get Citation Alerts
  • Abstract

    The concurrent memory reclamation problem is that of devising a way for a deallocating thread to verify that no other concurrent threads hold references to a memory block being deallocated. To date, in the absence of automatic garbage collection, there is no satisfactory solution to this problem; existing tracking methods like hazard pointers, reference counters, or epoch-based techniques like RCU are either prohibitively expensive or require significant programming expertise to the extent that implementing them efficiently can be worthy of a publication. None of the existing techniques are automatic or even semi-automated.
    In this article, we take a new approach to concurrent memory reclamation. Instead of manually tracking access to memory locations as done in techniques like hazard pointers, or restricting shared accesses to specific epoch boundaries as in RCU, our algorithm, called ThreadScan, leverages operating system signaling to automatically detect which memory locations are being accessed by concurrent threads.
    Initial empirical evidence shows that ThreadScan scales surprisingly well and requires negligible programming effort beyond the standard use of Malloc and Free.

    References

    [1]
    Yehuda Afek, Haim Kaplan, Boris Korenfeld, Adam Morrison, and Robert E. Tarjan. 2012. CBTree: A practical concurrent self-adjusting search tree. In Proceedings of the 26th International Conference on Distributed Computing (DISC’12). 1--15.
    [2]
    Dan Alistarh, Patrick Eugster, Maurice Herlihy, Alexander Matveev, and Nir Shavit. 2014. StackTrack: An automated transactional approach to concurrent memory reclamation. In Proceedings of the 9th European Conference on Computer Systems (EuroSys’14). ACM, New York, NY, Article 25, 14 pages.
    [3]
    Dan Alistarh, Justin Kopinsky, Jerry Li, and Nir Shavit. 2015. The sprayList: A scalable relaxed priority queue. In Proceedings of the 20th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP’15). ACM, New York, NY.
    [4]
    Dan Alistarh, William Leiserson, Alexander Matveev, and Nir Shavit. 2017. Forkscan: Conservative memory reclamation for modern operating systems. In Proceedings of the 12th European Conference on Computer Systems (EuroSys’17). ACM, New York, NY, 483--498.
    [5]
    Hillel Avni, Nir Shavit, and Adi Suissa. 2013. Leaplist: Lessons learned in designing Tm-supported range queries. In Proceedings of the 2013 ACM Symposium on Principles of Distributed Computing (PODC’13). ACM, New York, NY, 299--308.
    [6]
    Stephen M. Blackburn and Kathryn S. McKinley. 2003. Ulterior reference counting: Fast garbage collection without a long wait. In Proceedings of the 18th Annual ACM SIGPLAN Conference on Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA’03). ACM, New York, NY, 344--358.
    [7]
    Hans-Juergen Boehm. 1993. Space efficient conservative garbage collection. In Proceedings of the ACM SIGPLAN 1993 Conference on Programming Language Design and Implementation (PLDI’93). ACM, New York, NY, 197--206.
    [8]
    Anastasia Braginsky, Alex Kogan, and Erez Petrank. 2013. Drop the anchor: Lightweight memory management for non-blocking data structures. In Proceedings of the 25th ACM Symposium on Parallelism in Algorithms and Architectures (SPAA’13). ACM, New York, NY, 33--42.
    [9]
    Perry Cheng and Guy E. Blelloch. 2001. A parallel, real-time garbage collector. In Proceedings of the ACM SIGPLAN 2001 Conference on Programming Language Design and Implementation (PLDI’01). ACM, New York, NY, 125--136.
    [10]
    Austin T. Clements, M. Frans Kaashoek, and Nickolai Zeldovich. 2012. Scalable address spaces using RCU balanced trees. ACM SIGPLAN Not. 47, 4, 199--210.
    [11]
    David Detlefs, Paul A. Martin, Mark Moir, and Guy L. Steele Jr. 2002. Lock-free reference counting. Distrib. Comput. 15, 4, 255--271.
    [12]
    David L. Detlefs, Paul A. Martin, Mark Moir, and Guy L. Steele Jr. 2001. Lock-free reference counting. In Proceedings of the 20th Annual ACM Symposium on Principles of Distributed Computing (PODC’01). ACM, New York, NY, 190--199.
    [13]
    Aleksandar Dragojevic, Maurice Herlihy, Yossi Lev, and Mark Moir. 2011. On the power of hardware transactional memory to simplify memory management. In Proceedings of the 30th Annual ACM Symposium on Principles of Distributed Computing (PODC’11). 99--108.
    [14]
    Jason Evans. 2015. JEMalloc. Retrieved from http://www.canonware.com/jemalloc/.
    [15]
    Fitzpatrick. 2004. Distributed caching with memcached. Linux J. 124, 5. http://dl.acm.org/citation.cfm?id=1012894
    [16]
    Mikhail Fomitchev and Eric Ruppert. 2004. Lock-free linked lists and skip lists. In Proceedings of the 23rd Annual ACM Symposium on Principles of Distributed Computing (PODC’04). ACM, New York, NY, 50--59.
    [17]
    Keir Fraser. 2004. Practical Lock-Freedom. Technical Report UCAM-CL-TR-579. Computer Laboratory, University of Cambridge.
    [18]
    Keir Fraser and Timothy L. Harris. 2007. Concurrent programming without locks. ACM Trans. Comput. Syst. 25, 2, Article 5.
    [19]
    Sanjay Ghemawat and Paul Menage. (n.d.). TCMalloc: Thread-Caching Malloc. Retrieved from http://goog-perftools.sourceforge.net/doc/tcmalloc.html.
    [20]
    Anders Gidenstam, Marina Papatriantafilou, Håkan Sundell, and Philippas Tsigas. 2009. Efficient and reliable lock-free memory reclamation based on reference counting. IEEE Trans. Parallel Distrib. Syst. 20, 8, 1173--1187.
    [21]
    V. Gramoli. 2015. More than you ever wanted to know about synchronization: Synchrobench. In Proceedings of the 20th Annual ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP’15).
    [22]
    Sabine Hanke. 1999. The performance of concurrent red-black tree algorithms. In Algorithm Engineering. Lecture Notes in Computer Science, Vol. 1668. Springer, 286--300. http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.25.6504.
    [23]
    Tim L. Harris. 2001. A pragmatic implementation of non-blocking linked-lists. In Proceedings of the International Conference on Distributed Computing (DISC’01). 300--314.
    [24]
    Thomas E. Hart, Paul E. McKenney, Angela Demke Brown, and Jonathan Walpole. 2007. Performance of memory reclamation for lockless synchronization. J. Parallel Distrib. Comput. 67, 12, 1270--1285.
    [25]
    Steve Heller, Maurice Herlihy, Victor Luchangco, Mark Moir, William N. Scherer III, and Nir Shavit. 2006. A lazy concurrent list-based set algorithm. In Principles of Distributed Systems. Lecture Notes in Computer Science, Vol. 3974. Springer, 3--16.
    [26]
    Maurice Herlihy, Yossi Lev, Victor Luchangco, and Nir Shavit. 2007. A simple optimistic skiplist algorithm. In Proceedings of the 14th International Conference on Structural Information and Communication Complexity (SIROCCO’07). 124--138. http://dl.acm.org/citation.cfm?id=1760631.1760646.
    [27]
    Maurice Herlihy, Victor Luchangco, Paul Martin, and Mark Moir. 2005. Nonblocking memory management support for dynamic-sized data structures. ACM Trans. Comput. Syst. 23, 2, 146--196.
    [28]
    Maurice Herlihy and Nir Shavit. 2008. The Art of Multiprocessor Programming. Morgan Kaufmann, San Francisco, CA.
    [29]
    Maurice Herlihy, Nir Shavit, and Moran Tzafrir. 2008. Hopscotch hashing. In Proceedings of the 22nd International Symposium on Distributed Computing (DISC’08). 350--364. http://dl.acm.org/citation.cfm?id=1432316
    [30]
    Michael Kerrisk. 2010. The Linux Programming Interface. No Starch Press, San Francisco, CA.
    [31]
    Gabriel Kliot, Erez Petrank, and Bjarne Steensgaard. 2009. A lock-free, concurrent, and incremental stack scanning mechanism for garbage collectors. SIGOPS Oper. Syst. Rev. 43, 3, 3--13.
    [32]
    Doug Lea. 2005. Java Concurrency Package. Retrieved from http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/.
    [33]
    Doug Lea. 2007. Class ConcurrentHashMap<K,V>. Retrieved from http://g.oswego.edu/dl/jsr166/dist/docs/java.base/java/util/concurrent/ConcurrentHashMap.html.
    [34]
    Doug Lea. 2007. Class ConcurrentSkipListMap<K,V>. Retrieved from http://java.sun.com/javase/6/docs/api/java/util/concurrent/ConcurrentSkipListMap.html.
    [35]
    I-Ting Angelina Lee, Silas Boyd-Wickizer, Zhiyi Huang, and Charles E. Leiserson. 2010. Using memory mapping to support cactus stacks in work-stealing runtime systems. In Proceedings of the 19th International Conference on Parallel Architecture and Compilation Techniques (PACT’10). ACM, New York, NY, 411--420.
    [36]
    William M. Leiserson. 2015. ThreadScan Git Repository. Retrieved from https://github.com/Willtor/ThreadScan.
    [37]
    Yossi Levanoni and Erez Petrank. 2006. An on-the-fly reference-counting garbage collector for java. ACM Trans. Program. Lang. Syst. 28, 1, 1--69.
    [38]
    Robert Love. 2013. Linux System Programming (2nd ed.). O’Reilly Media, Sebastopol, CA.
    [39]
    Redis Labs Ltd. (n.d.). Memtier Benchmark. Retrieved from https://github.com/RedisLabs/memtier_benchmark.
    [40]
    P. E. McKenney, J. Appavoo, A. Kleen, O. Krieger, R. Russell, D. Sarma, and M. Soni. 2001. Read-copy update. In Proceedings of the Ottawa Linux Symposium. 338--367.
    [41]
    Maged M. Michael. 2004. Hazard pointers: Safe memory reclamation for lock-free objects. IEEE Trans. Parallel Distrib. Syst. 15, 6, 491--504.
    [42]
    Mark Moir and Nir Shavit. 2007. Concurrent data structures. In Handbook of Data Structures and Applications. Chapman 8 Hall/CRC, Boca Raton, FL, 47-1.
    [43]
    Objective-C. 2014. Automatic Reference Counting. Retrieved from http://en.wikipedia.org/wiki/Automatic_Reference_Counting.
    [44]
    Mark Russinovich and David A. Solomon. 2009. Windows Internals: Including Windows Server 2008 and Windows Vista (5th ed.). Microsoft Press.
    [45]
    Anthony Savidis. 2004. The implementation of generic smart pointers for advanced defensive programming. Softw. Pract. Exper. 34, 10, 977--1009.
    [46]
    Ori Shalev and Nir Shavit. 2006. Split-ordered lists: Lock-free extensible hash tables. J. ACM 53, 3, 379--405.
    [47]
    Nir Shavit and Itay Lotan. 2000. Skiplist-based concurrent priority queues. In Proceedings of the 14th International Parallel and Distributed Processing Symposium, (IPDPS’00). IEEE, Los Alamitos, CA, 263--268.
    [48]
    John D. Valois. 1995. Lock-free linked lists using compare-and-swap. In Proceedings of the 14th Annual ACM Symposium on Principles of Distributed Computing (PODC’95). 214--222.
    [49]
    Wikipedia. 2018. Signal (IPC). Retrieved from http://en.wikipedia.org/wiki/Unix_signal.

    Cited By

    View all
    • (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)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: 1-Feb-2024
    • Show More Cited By

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Transactions on Parallel Computing
    ACM Transactions on Parallel Computing  Volume 4, Issue 4
    Special Issue on SPAA 2015
    December 2017
    122 pages
    ISSN:2329-4949
    EISSN:2329-4957
    DOI:10.1145/3177741
    Issue’s Table of Contents
    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 the author(s) 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].

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 01 May 2018
    Accepted: 01 January 2018
    Revised: 01 January 2018
    Received: 01 May 2016
    Published in TOPC Volume 4, Issue 4

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. Concurrent data structures
    2. lock-based data structures
    3. lock-free data structures
    4. memory reclamation

    Qualifiers

    • Research-article
    • Research
    • Refereed

    Funding Sources

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)18
    • Downloads (Last 6 weeks)5
    Reflects downloads up to 09 Aug 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (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)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: 1-Feb-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
    • (2023)The ERA Theorem for Safe Memory ReclamationProceedings of the 2023 ACM Symposium on Principles of Distributed Computing10.1145/3583668.3594564(102-112)Online publication date: 19-Jun-2023
    • (2023)Applying Hazard Pointers to More Concurrent Data StructuresProceedings of the 35th ACM Symposium on Parallelism in Algorithms and Architectures10.1145/3558481.3591102(213-226)Online publication date: 17-Jun-2023
    • (2021)Snapshot-free, transparent, and robust memory reclamation for lock-free data structuresProceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation10.1145/3453483.3454090(987-1002)Online publication date: 19-Jun-2021
    • (2021)Concurrent deferred reference counting with constant-time overheadProceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation10.1145/3453483.3454060(526-541)Online publication date: 19-Jun-2021
    • (2021)NBRProceedings of the 26th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming10.1145/3437801.3441625(175-190)Online publication date: 17-Feb-2021
    • (2021)OrcGCProceedings of the 26th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming10.1145/3437801.3441596(205-218)Online publication date: 17-Feb-2021

    View Options

    Get Access

    Login options

    Full Access

    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