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 paper, 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.
- Yehuda Afek, Haim Kaplan, Boris Korenfeld, Adam Morrison, and Robert E. Tarjan. Cbtree: A practical concurrent self-adjusting search tree. In Proceedings of the 26th International Conference on Distributed Computing, DISC'12, pages 1--15, Berlin, Heidelberg, 2012. Springer-Verlag. Google ScholarDigital Library
- Dan Alistarh, Patrick Eugster, Maurice Herlihy, Alexander Matveev, and Nir Shavit. Stacktrack: An automated transactional approach to concurrent memory reclamation. In Proceedings of the Ninth European Conference on Computer Systems, EuroSys '14, pages 25:1--25:14, New York, NY, USA, 2014. ACM. Google ScholarDigital Library
- Dan Alistarh, Justin Kopinsky, Jerry Li, and Nir Shavit. The spraylist: A scalable relaxed priority queue. In 20th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPoPP 2015, San Francisco, CA, USA, 2015. ACM. Google ScholarDigital Library
- Hillel Avni, Nir Shavit, and Adi Suissa. Leaplist: Lessons learned in designing tm-supported range queries. In Proceedings of the 2013 ACM Symposium on Principles of Distributed Computing, PODC '13, pages 299--308, New York, NY, USA, 2013. ACM. Google ScholarDigital Library
- Stephen M. Blackburn and Kathryn S. McKinley. 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, pages 344--358, New York, NY, USA, 2003. ACM. Google ScholarDigital Library
- Hans-Juergen Boehm. Space efficient conservative garbage collection. In Proceedings of the ACM SIGPLAN 1993 Conference on Programming Language Design and Implementation, PLDI '93, pages 197--206, New York, NY, USA, 1993. ACM. Google ScholarDigital Library
- Anastasia Braginsky, Alex Kogan, and Erez Petrank. 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, pages 33--42, New York, NY, USA, 2013. ACM. Google ScholarDigital Library
- Perry Cheng and Guy E. Blelloch. A parallel, real-time garbage collector. In Proceedings of the ACM SIGPLAN 2001 Conference on Programming Language Design and Implementation, PLDI '01, pages 125--136, New York, NY, USA, 2001. ACM. Google ScholarDigital Library
- Austin T. Clements, M. Frans Kaashoek, and Nickolai Zeldovich. Scalable address spaces using rcu balanced trees. SIGPLAN Not., 47(4):199--210, March 2012. Google ScholarDigital Library
- David Detlefs, Paul A. Martin, Mark Moir, and Guy L. Steele Jr. Lock-free reference counting. Distributed Computing, 15(4):255--271, 2002. Google ScholarDigital Library
- David L. Detlefs, Paul A. Martin, Mark Moir, and Guy L. Steele, Jr. Lock-free reference counting. In Proceedings of the twentieth annual ACM symposium on Principles of distributed computing, PODC '01, pages 190--199, New York, NY, USA, 2001. ACM. http://doi.acm.org/10.1145/383962.384016. Google ScholarDigital Library
- Aleksandar Dragojevic, Maurice Herlihy, Yossi Lev, and Mark Moir. 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), pages 99--108, 2011. Google ScholarDigital Library
- Mikhail Fomitchev and Eric Ruppert. Lock-free linked lists and skip lists. In Proceedings of the 23rd annual ACM symposium on Principles of Distributed Computing (PODC' 04), pages 50--59, New York, NY, USA, 2004. ACM Press. http://doi.acm.org/10.1145/1011767.1011776. Google ScholarDigital Library
- Keir Fraser. Practical lock-freedom. Technical Report UCAM-CL-TR-579, University of Cambridge, Computer Laboratory, February 2004.Google Scholar
- Keir Fraser and Timothy L. Harris. Concurrent programming without locks. ACM Trans. Comput. Syst., 25(2), 2007. Google ScholarDigital Library
- Sanjay Ghemawat and Paul Menage. Tcmalloc, Retrieved 2015. Available at http://goog-perftools.sourceforge.net/doc/tcmalloc.html.Google Scholar
- Anders Gidenstam, Marina Papatriantafilou, Håkan Sundell, and Philippas Tsigas. Efficient and reliable lock-free memory reclamation based on reference counting. IEEE Trans. Parallel Distrib. Syst., 20(8):1173--1187, 2009. Google ScholarDigital Library
- V. Gramoli. 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), 2015. Google ScholarDigital Library
- Sabine Hanke. The performance of concurrent red-black tree algorithms. In Jeffrey Vitter and Christos Zaroliagis, editors, Algorithm Engineering, volume 1668 of Lecture Notes in Computer Science, pages 286--300. Springer Berlin / Heidelberg, 1999. http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.25.6504. Google ScholarDigital Library
- Tim L. Harris. A pragmatic implementation of non-blocking linked-lists. In Proceedings of the International Conference on Distributed Computing (DISC), pages 300--314, 2001. Google ScholarDigital Library
- Thomas E. Hart, Paul E. McKenney, Angela Demke Brown, and Jonathan Walpole. Performance of memory reclamation for lockless synchronization. J. Parallel Distrib. Comput., 67(12):1270--1285, 2007. Google ScholarDigital Library
- Steve Heller, Maurice Herlihy, Victor Luchangco, Mark Moir, William N. Scherer III, and Nir Shavit. A lazy concurrent list-based set algorithm. In James H. Anderson, Giuseppe Prencipe, and Roger Wattenhofer, editors, Proceedings of the 9th International Conference on Principles of Distributed Systems (OPODIS 2005), Revised Selected Papers, volume 3974 of Lecture Notes in Computer Science, pages 3--16. Springer, 2006. http://dx.doi.org/10.1007/11795490_3. Google ScholarDigital Library
- Maurice Herlihy, Yossi Lev, Victor Luchangco, and Nir Shavit. A simple optimistic skiplist algorithm. In Proceedings of the 14th international conference on Structural information and communication complexity, SIROCCO'07, pages 124--138, Berlin, Heidelberg, 2007. Springer-Verlag. http://dl.acm.org/citation.cfm?id=1760631.1760646. Google ScholarDigital Library
- Maurice Herlihy, Victor Luchangco, Paul Martin, and Mark Moir. Nonblocking memory management support for dynamic-sized data structures. ACM Trans. Comput. Syst., 23(2):146--196, May 2005. Google ScholarDigital Library
- Maurice Herlihy and Nir Shavit. The Art of Multiprocessor Programming. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 2008. Google ScholarDigital Library
- Maurice Herlihy, Nir Shavit, and Moran Tzafrir. Hopscotch hashing. In Proceedings of the 22nd international symposium on Distributed Computing, DISC '08, pages 350--364, Berlin, Heidelberg, 2008. Springer-Verlag. http://dl.acm.org/citation.cfm?id=1432316. Google ScholarDigital Library
- Michael Kerrisk. The Linux Programming Interface. No Starch Press, Inc., San Francisco, CA 94103, 2010. Google ScholarDigital Library
- Gabriel Kliot, Erez Petrank, and Bjarne Steensgaard. A lock-free, concurrent, and incremental stack scanning mechanism for garbage collectors. SIGOPS Oper. Syst. Rev., 43(3):3--13, July 2009. Google ScholarDigital Library
- Doug Lea. Java concurrency package, 2005. Available at http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/.Google Scholar
- Doug Lea, 2007. http://g.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/ConcurrentHashMap.html.Google Scholar
- Doug Lea, 2007. http://java.sun.com/javase/6/docs/api/java/util/concurrent/ConcurrentSkipListMap.html.Google Scholar
- I-Ting Angelina Lee, Silas Boyd-Wickizer, Zhiyi Huang, and Charles E. Leiserson. Using memory mapping to support cactus stacks in work-stealing runtime systems. In Valentina Salapura, Michael Gschwind, and Jens Knoop, editors, 19th International Conference on Parallel Architecture and Compilation Techniques (PACT 2010), Vienna, Austria, September 11--15, 2010, pages 411--420. ACM, 2010. Google ScholarDigital Library
- William M. Leiserson. Threadscan git repository, 2015. Available at https://github.com/Willtor/ThreadScan.Google Scholar
- Yossi Levanoni and Erez Petrank. An on-the-fly reference-counting garbage collector for java. ACM Trans. Program. Lang. Syst., 28(1):1--69, January 2006. Google ScholarDigital Library
- Robert Love. Linux System Programming, 2nd Edition. O'Reilly Media, Sebastopol, CA 95472, 2013.Google Scholar
- P. E. McKenney, J. Appavoo, A. Kleen, O. Krieger, R. Russell, D. Sarma, and M. Soni. Read-copy update. In Proc. of the Ottawa Linux Symposium, page 338--367, 2001.Google Scholar
- Maged M. Michael. Hazard pointers: Safe memory reclamation for lock-free objects. IEEE Trans. Parallel Distrib. Syst., 15(6):491--504, 2004. Google ScholarDigital Library
- Mark Moir and Nir Shavit. Concurrent data structures. Handbook of Data Structures and Applications, pages 47--14, 2007.Google Scholar
- Objective-C, 2014. http://en.wikipedia.org/wiki/Automatic_Reference_Counting.Google Scholar
- Mark Russinovich and David A. Solomon. Windows Internals: Including Windows Server 2008 and Windows Vista, Fifth Edition. Microsoft Press, 5th edition, 2009. Google ScholarDigital Library
- Anthony Savidis. The implementation of generic smart pointers for advanced defensive programming. Softw., Pract. Exper., 34(10):977--1009, 2004. Google ScholarDigital Library
- Ori Shalev and Nir Shavit. Split-ordered lists: Lock-free extensible hash tables. J. ACM, 53:379--405, May 2006. http://doi.acm.org/10.1145/1147954.1147958. Google ScholarDigital Library
- Nir Shavit and Itay Lotan. Skiplist-based concurrent priority queues. In Parallel and Distributed Processing Symposium, 2000. IPDPS 2000. Proceedings. 14th International, pages 263--268. IEEE, 2000. Google ScholarDigital Library
- John D. Valois. Lock-free linked lists using compare-and-swap. In Proceedings of the 14th Annual ACM Symposium on Principles of Distributed Computing (PODC), pages 214--222, 1995. Google ScholarDigital Library
- WIKI. http://en.wikipedia.org/wiki/Unix_signal.Google Scholar
Index Terms
- ThreadScan: Automatic and Scalable Memory Reclamation
Recommendations
Forkscan: Conservative Memory Reclamation for Modern Operating Systems
EuroSys '17: Proceedings of the Twelfth European Conference on Computer SystemsThe problem of efficient concurrent memory reclamation in unmanaged languages such as C or C++ is one of the major challenges facing the parallelization of billions of lines of legacy code. Garbage collectors for C/C++ can be inefficient; thus, ...
ThreadScan: Automatic and Scalable Memory Reclamation
Special Issue on SPAA 2015The 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 ...
Hand-Over-Hand Transactions with Precise Memory Reclamation
SPAA '17: Proceedings of the 29th ACM Symposium on Parallelism in Algorithms and ArchitecturesIn this paper, we introduce revocable reservations, a transactional memory mechanism to reserve locations in one transaction and check whether they are unchanged in a subsequent transaction without preventing reserved locations from being reclaimed in ...
Comments