Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/3620666.3651326acmconferencesArticle/Chapter ViewAbstractPublication PagesasplosConference Proceedingsconference-collections
research-article
Open access

Getting a Handle on Unmanaged Memory

Published: 27 April 2024 Publication History

Abstract

The inability to relocate objects in unmanaged languages brings with it a menagerie of problems. Perhaps the most impactful is memory fragmentation, which has long plagued applications such as databases and web servers. These issues either fester or require Herculean programmer effort to address on a per-application basis because, in general, heap objects cannot be moved in unmanaged languages. In contrast, managed languages like C# cleanly address fragmentation through the use of compacting garbage collection techniques built upon heap object movement. In this work, we bridge this gap between unmanaged and managed languages through the use of handles, a level of indirection allowing heap object movement. Handles open the door to seamlessly employing runtime features from managed languages in existing, unmodified code written in unmanaged languages. We describe a new compiler and runtime system, Alaska, that acts as a drop-in replacement for malloc. Without any programmer effort, the Alaska compiler transforms pointer-based code to utilize handles, with optimizations to minimize performance impact. A codesigned runtime system manages this new level of indirection and exploits heap object movement via an extensible service interface. We investigate the overheads of Alaska on large benchmarks and applications spanning multiple domains. To show the power and extensibility of handles, we use Alaska to eliminate fragmentation on the heap through defragmentation, reducing memory usage by up to 40% in Redis.

References

[1]
The GNU C library https://www.gnu.org/software/libc/libc.html.
[2]
The libunwind project https://www.nongnu.org/libunwind/.
[3]
memcached https://memcached.org/.
[4]
MUSL libc https://musl.libc.org.
[5]
Oilpan: C++ garbage collection https://chromium.googlesource.com/v8/v8/+/main/include/cppgc/README.md.
[6]
Redis active memory defragmentation https://github.com/redis/redis/pull/3720.
[7]
Redis https://redis.io/.
[8]
Spec cpu 2017 - gcc_s description https://www.spec.org/cpu2017/Docs/benchmarks/602.gcc.html.
[9]
Spec cpu 2017 - perlbench_s description https://www.spec.org/cpu2017/Docs/benchmarks/600.perlbench_s.html.
[10]
Stack maps and patch points in LLVM --- LLVM documentation https://llvm.org/docs/StackMaps.html.
[11]
Tiobe index https://www.tiobe.com/tiobe-index/, Jun 2022.
[12]
Propeller: A Profile Guided, Relinking Optimizer for Warehouse-Scale Applications, ASPLOS 2023, New York, NY, USA, 2023. Association for Computing Machinery.
[13]
Ole Agesen. Gc points in a threaded environment. Technical report, USA, 1998.
[14]
Ole Agesen, David Detlefs, and J. Eliot Moss. Garbage collection and local variable type-precision and liveness in java virtual machines. page 269--279, 1998.
[15]
Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools (2nd Edition). Addison-Wesley Longman Publishing Co., Inc., USA, 2006.
[16]
David Bailey, Tim Harris, William Saphir, Rob Van Der Wijngaart, Alex Woo, and Maurice Yarrow. The nas parallel benchmarks 2.0. Technical report, Technical Report NAS-95-020, NASA Ames Research Center, 1995.
[17]
Scott Beamer, Krste Asanović, and David Patterson. The gap benchmark suite. arXiv preprint arXiv:1508.03619, 2015.
[18]
Michael A Bender, Alex Conway, Martín Farach-Colton, William Kuszmaul, and Guido Tagliavini. Tiny pointers. In Proceedings of the 2023 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 477--508. SIAM, 2023.
[19]
J Bennett, P Dabbelt, C Garlati, GS Madhusudan, T Mudge, and D Patterson. Embench: An evolving benchmark suite for embedded iot computers from an academic-industrial cooperative, 2022.
[20]
Stephen M. Blackburn and Antony L. Hosking. Barriers: friend or foe? In Proceedings of the 4th International Symposium on Memory Management, ISMM '04, page 143--151, New York, NY, USA, 2004. Association for Computing Machinery.
[21]
Trishul M. Chilimbi, Mark D. Hill, and James R. Larus. Cache-conscious structure layout. SIGPLAN Not., 34(5):1--12, may 1999.
[22]
Brian F. Cooper, Adam Silberstein, Erwin Tam, Raghu Ramakrishnan, and Russell Sears. Benchmarking cloud serving systems with ycsb. In Proceedings of the 1st ACM Symposium on Cloud Computing, SoCC '10, page 143--154, New York, NY, USA, 2010. Association for Computing Machinery.
[23]
Robert Courts. Improving locality of reference in a garbage-collecting memory management system. Commun. ACM, 31(9):1128--1138, sep 1988.
[24]
David Detlefs. Garbage collection and run-time typing as a c++ library. In C++ Conference, 1992. URL: https://api.semanticscholar.org/CorpusID:18789768.
[25]
Chen Ding and Ken Kennedy. Improving cache performance in dynamic applications through data and computation reorganization at run time. In Proceedings of the ACM SIGPLAN 1999 Conference on Programming Language Design and Implementation, PLDI '99, page 229--241, New York, NY, USA, 1999. Association for Computing Machinery.
[26]
Daniel R. Edelson. Precompiling c++ for garbage collection. In Proceedings of the International Workshop on Memory Management, IWMM '92, page 299--314, Berlin, Heidelberg, 1992. Springer-Verlag.
[27]
Jason Evans. Tick tock, malloc needs a clock. In Applicative 2015, Applicative 2015, New York, NY, USA, 2015. Association for Computing Machinery.
[28]
Christine H. Flood, Roman Kennke, Andrew Dinn, Andrew Haley, and Roland Westrelin. Shenandoah: An open-source concurrent compacting garbage collector for openjdk. 2016.
[29]
Bolei Guo, Matthew J. Bridges, Spyridon Triantafyllis, Guilherme Ottoni, Easwaran Raman, and David I. August. Practical and accurate low-level pointer analysis. In Proceedings of the International Symposium on Code Generation and Optimization, CGO '05, USA, 2005. IEEE Computer Society.
[30]
Zhiyuan Guo, Zijian He, and Yiying Zhang. Mira: A program-behavior-guided far memory system. In Proceedings of the 29th Symposium on Operating Systems Principles, SOSP '23, page 692--708, New York, NY, USA, 2023. Association for Computing Machinery.
[31]
Apple Computer Inc, editor. Inside Macintosh. Vol. 2, volume 2. Addison-Wesley, 14. printing edition.
[32]
Douglas Johnson. The case for a read barrier. In Proceedings of the Fourth International Conference on Architectural Support for Programming Languages and Operating Systems, ASPLOS IV, page 279--287, New York, NY, USA, 1991. Association for Computing Machinery.
[33]
Teresa Johnson, Mehdi Amini, and Xinliang David Li, editors. ThinLTO: Scalable and incremental LTO, 2017. URL: https://research.google/pubs/thinlto-scalable-and-incremental-lto/.
[34]
Chris Lattner and Vikram Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In International Symposium on Code Generation and Optimization, 2004. CGO 2004., pages 75--86. IEEE, 2004.
[35]
Chris Lattner and Vikram Adve. Automatic pool allocation: Improving performance by controlling data structure layout in the heap. In Proceedings of the 2005 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI '05, page 129--142, New York, NY, USA, 2005. Association for Computing Machinery.
[36]
Angelo Matni, Enrico Armenio Deiana, Yian Su, Lukas Gross, Souradip Ghosh, Sotiris Apostolakis, Ziyang Xu, Zujun Tan, Ishita Chaturvedi, David I. August, and Simone Campanoni. NOELLE Offers Empowering LLvm Extensions. In International Symposium on Code Generation and Optimization, 2022. CGO 2022., 2022.
[37]
Tommy McMichen, Nathan Greiner, Peter Zhong, Federico Sossai, Atmn Patel, and Simone Campanoni. Representing data collections in an ssa form. In 2024 IEEE/ACM International Symposium on Code Generation and Optimization (CGO), 2024.
[38]
Pekka P. Pirinen. Barrier techniques for incremental tracing. SIGPLAN Not., 34(3):20--25, oct 1998.
[39]
Filip Pizlo, Lukasz Ziarek, Petr Maj, Antony L. Hosking, Ethan Blanton, and Jan Vitek. Schism: Fragmentation-tolerant real-time garbage collection. SIGPLAN Not., 45(6):146--159, jun 2010.
[40]
Bobby Powers, David Tench, Emery D. Berger, and Andrew McGregor. Mesh: Compacting memory management for c/c++ applications. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2019, page 333--346, New York, NY, USA, 2019. Association for Computing Machinery.
[41]
J. M. Robson. Worst case fragmentation of first fit and best fit storage allocation strategies. The Computer Journal, 20(3):242--244, 01 1977.
[42]
Zhenyuan Ruan, Malte Schwarzkopf, Marcos K. Aguilera, and Adam Belay. AIFM: High-performance, application-integrated far memory. In Proceedings of the 14th USENIX Symposium on Operating Systems Design and Implementation, OSDI '20, pages 315--332, Berkeley, CA, USA, November 2020. USENIX Association. URL: https://www.usenix.org/conference/osdi20/presentation/ruan.
[43]
Sagi Shahar, Shai Bergman, and Mark Silberstein. Activepointers: A case for software address translation on gpus. SIGARCH Comput. Archit. News, 44(3):596--608, jun 2016.
[44]
Bjarne Steensgaard. Points-to analysis in almost linear time. In Proceedings of the 23rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 32--41, 1996.
[45]
Brian Suchy, Simone Campanoni, Nikos Hardavellas, and Peter Dinda. Carat: A case for virtual memory through compiler- and runtime-based address translation. In Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2020, page 329--345, New York, NY, USA, 2020. Association for Computing Machinery.
[46]
Brian Suchy, Souradip Ghosh, Drew Kersnar, Siyuan Chai, Zhen Huang, Aaron Nelson, Michael Cuevas, Alex Bernat, Gaurav Chaudhary, Nikos Hardavellas, Simone Campanoni, and Peter Dinda. Carat cake: Replacing paging via compiler/kernel cooperation. In Proceedings of the 27th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, ASPLOS '22, page 98--114, New York, NY, USA, 2022. Association for Computing Machinery.
[47]
Yulei Sui and Jingling Xue. Svf: interprocedural static value-flow analysis in llvm. In Proceedings of the 25th international conference on compiler construction, 2016.
[48]
Brian Tauro, Brian Suchy, Simone Campanoni, Peter Dinda, and Kyle Hale. TrackFM: Far-out compiler support for a far memory world. In Proceedings of the 29th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, ASPLOS '24. Association for Computing Machinery, 2024.
[49]
Harmen L. A. van der Spek, C. W. Mattias Holm, and Harry A. G. Wijshoff. Automatic Restructuring of Linked Data Structures, volume 5898 of Lecture Notes in Computer Science, page 263--277. Springer Berlin Heidelberg, Berlin, Heidelberg, 2010. URL: http://link.springer.com/10.1007/978-3-642-13374-9_18.
[50]
Zhenjiang Wang, Chenggang Wu, Pen-Chung Yew, Jianjun Li, and Di Xu. On-the-fly structure splitting for heap objects. ACM Transactions on Architecture and Code Optimization, 8(4):1--20, Jan 2012.
[51]
Robert N.M. Watson, Jonathan Woodruff, Peter G. Neumann, Simon W. Moore, Jonathan Anderson, David Chisnall, Nirav Dave, Brooks Davis, Khilan Gudka, Ben Laurie, Steven J. Murdoch, Robert Norton, Michael Roe, Stacey Son, and Munraj Vadera. Cheri: A hybrid capability-system architecture for scalable software compartmentalization. In 2015 IEEE Symposium on Security and Privacy, pages 20--37, 2015.
[52]
Jonathan Woodruff, Robert N.M. Watson, David Chisnall, Simon W. Moore, Jonathan Anderson, Brooks Davis, Ben Laurie, Peter G. Neumann, Robert Norton, and Michael Roe. The cheri capability model: Revisiting risc in an age of risk. In Proceeding of the 41st Annual International Symposium on Computer Architecuture, ISCA '14, page 457--468. IEEE Press, 2014.
[53]
Zhen Xie, Jie Liu, Jiajia Li, and Dong Li. Merchandiser: Data placement on heterogeneous memory for task-parallel hpc applications with load-balance awareness. page 204--217, 2023.
[54]
Benjamin Zorn. Barrier methods for garbage collection. 11 1990. URL: https://spl.cde.state.co.us/artemis/ucbserials/ucb51110internet/1990/ucb51110494internet.pdf.

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ASPLOS '24: Proceedings of the 29th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 3
April 2024
1106 pages
ISBN:9798400703867
DOI:10.1145/3620666
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].

Sponsors

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 27 April 2024

Check for updates

Badges

Qualifiers

  • Research-article

Funding Sources

Conference

ASPLOS '24

Acceptance Rates

Overall Acceptance Rate 202 of 987 submissions, 20%

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 579
    Total Downloads
  • Downloads (Last 12 months)579
  • Downloads (Last 6 weeks)59
Reflects downloads up to 16 Jan 2025

Other Metrics

Citations

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