Memory Management for Multi-Language Multi-Runtime Systems on Multi-Core Architectures
Total Page:16
File Type:pdf, Size:1020Kb
UNIVERSITY OF CALIFORNIA Santa Barbara Memory Management for Multi-Language Multi-Runtime Systems on Multi-Core Architectures A Dissertation submitted in partial satisfaction of the requirements for the degree of Doctor of Philosophy in Computer Science by Michal Wegiel Committee in Charge: Professor Chandra Krintz, Chair Professor Amr El Abbadi Professor Ben Zhao March 2011 The Dissertation of Michal Wegiel is approved: Professor Amr El Abbadi Professor Ben Zhao Professor Chandra Krintz, Committee Chairperson January 2011 Memory Management for Multi-Language Multi-Runtime Systems on Multi-Core Architectures Copyright © 2011 by Michal Wegiel iii Dedication and Gratitude I dedicate this dissertation to my family: my parents, Maria and Krzysztof, and my sister, Barbara, for their unconditional support and encouragement throughout all stages of my education. I am deeply grateful to Chandra Krintz for all the support, guidance, mentorship, and help that she has provided during the entire process. I would like to thank Ben Zhao, Amr El Abbadi, and Rich Wolski for serving on my Ph.D. committee. I am grateful to Grzegorz Czajkowski and Laurent Daynes for being my mentors and collaborators during my internship at Sun Labs. Finally, I would like to thank the staff, faculty, and fellow graduate students at the Com- puter Science department at UC Santa Barbara for their support and the opportunity to pursue this work. iv Acknowledgements The text of Chapters 3–7 is in part a reprint of the material as it appears in the conference proceedings listed below. The dissertation author was the primary researcher while the co-author listed on each publication directed and supervised the research which forms the basis for these chapters. Chapter 3: Publication [159] in the ACM/SIGPLAN International Conference on Ar- chitectural Support for Programming Languages and Operating Systems (ASPLOS 2008). Chapter 4: Publication [161] in the ACM/SIGPLAN International Conference on Ar- chitectural Support for Programming Languages and Operating Systems (ASPLOS 2009). Chapter 5: Publication [163] as UCSB Technical Report 2010-15. Chapter 6: Publication [160] in the ACM/SIGPLAN International Conference on Pro- gramming Language Design and Implementation (PLDI 2008). Chapter 7: Publication [164] in the ACM/SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2010). v Curriculum Vitæ Michal Wegiel Education 2011 Doctor of Philosophy in Computer Science, University of California, Santa Barbara. 2006 Master of Science in Computer Science, University of Science and Technology, Krakow, Poland. Experience 2006 – 2010 Graduate Research Assistant, University of California, Santa Barbara. 2004 – 2005 Research Intern, Sun Microsystems Laboratories, Menlo Park, CA. 2002 Student Intern, Motorola Global Software Group, Krakow, Poland. Awards 2010 Dissertation Year Fellowship, University of California, Santa Barbara. 2006 – 2008 Regents Central Fellowship, University of California, Santa Barbara. vi Publications Michal Wegiel and Chandra Krintz: “Cross-Language, Type-Safe, and Transparent Ob- ject Sharing For Co-Located Managed Runtimes.” In the ACM/SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), 2010. Michal Wegiel and Chandra Krintz: “Concurrent Collection as an Operating System Service for Cross-Runtime Cross-Language Memory Management.” UCSB Technical Report #2010-15, 2010. Michal Wegiel and Chandra Krintz: “Dynamic Prediction of Collection Yield for Man- aged Runtimes.” In the ACM/SIGPLAN International Conference on Architectural Sup- port for Programming Languages and Operating Systems (ASPLOS), 2009. Michal Wegiel and Chandra Krintz: “The Single-Referent Collector: Optimizing Com- paction for the Common Case.” In the ACM/SIGPLAN Transactions on Architecture and Code Optimization (TACO), 2009. Michal Wegiel and Chandra Krintz: “XMem: Type-Safe, Transparent, Shared Memory for Cross-Runtime Communication and Coordination.” In the ACM/SIGPLAN Inter- national Conference on Programming Language Design and Implementation (PLDI), 2008. Michal Wegiel and Chandra Krintz: “The Mapping Collector: Virtual Memory Sup- port for Generational, Parallel, and Concurrent Compaction.” In the ACM/SIGPLAN International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), 2008. Field of Study: Computer Science vii Abstract Memory Management for Multi-Language Multi-Runtime Systems on Multi-Core Architectures Michal Wegiel To manage the increasing complexity of software, developers employ a number of different strategies. These include using high-level, type-safe, object-oriented pro- gramming languages, executing applications within managed runtime environments (MREs), modularizing software into independent isolated components, and maximiz- ing programmer productivity by implementing each component in the most-suitable language. Moreover, administrators and tools increasingly co-locate components on the same physical machine to better utilize multi-core systems via thread-level par- allelism and to enable efficient cross-component communication. As a result, multi- language, multi-runtime systems that employ component co-location on multi-core shared-memory architectures are more and more common. In such systems, memory management takes place within runtimes (intra-runtime) and between runtimes (cross-runtime). Intra-runtime memory management includes allocation and automatic reclamation of objects within an MRE. Cross-runtime memory management refers to communication, coordination, and object sharing across MREs. Both intra-runtime and cross-runtime memory management rely on the mechanisms and abstractions of the underlying operating system (OS) for efficient implementation. viii The focus of our research is to identify ways to more effectively exploit extant OS functionality to improve intra-runtime and cross-runtime memory management in terms of performance as well as programming model. Specifically, we design, implement, and evaluate MRE extensions that leverage virtual memory, shared memory, and shared libraries to better coordinate memory management across the system layers. For intra-runtime memory management, we develop new techniques to improve throughput, reduce pauses, increase yield, and enhance modularity of parallel and con- current collectors. For cross-runtime memory management, we investigate type-safe, transparent object sharing between isolated MREs to enable cross-language communi- cation and synchronization without expensive object serialization and explicit message passing. Our empirical results indicate that our contributions significantly improve both intra-runtime and cross-runtime memory management by better leveraging OS support. We obtain large performance gains for parallel and concurrent collectors as well as inter-runtime communication over the state-of-the-art memory management systems. In addition, our techniques enhance the programming model for both application de- velopers and runtime architects. ix Contents Acknowledgements v Curriculum Vitæ vi Abstract viii List of Figures xv List of Tables xvii 1 Introduction 1 1.1 Thesis Question ............................ 7 1.2 Dissertation Organization ....................... 9 2 Background 10 2.1 Intra-Runtime Memory Management ................. 10 2.1.1 State-of-the-Art GC Techniques ................ 11 2.1.2 OS-Assisted GC ........................ 17 2.1.3 Limitations .......................... 26 2.2 Cross-Runtime Memory Management ................. 30 2.2.1 State-of-the-art Inter-Process Communication ......... 31 2.2.2 Cross-Runtime Communication and Coordination ....... 37 2.2.3 Limitations .......................... 44 3 Efficient Compaction by Mapping: Improving Intra-Runtime Memory Management Performance Using Virtual Memory 51 3.1 Introduction and Motivation ...................... 52 3.2 Design and Implementation ...................... 55 x 3.2.1 Stop-the-World/Concurrent Marking ............. 58 3.2.2 Stop-the-World Unmapping .................. 59 3.2.3 Concurrent Unmapping .................... 61 3.2.4 Bounding Space Overhead ................... 62 3.2.5 Implementation Details .................... 63 3.3 Experimental Evaluation ........................ 67 3.3.1 Benchmarks .......................... 67 3.3.2 Methodology ......................... 69 3.3.3 Clustering ........................... 70 3.3.4 Stop-the-World Compactors .................. 71 3.3.5 Concurrent Compactors .................... 81 3.3.6 Stop-the-World/Concurrent Tradeoffs ............. 84 3.3.7 Unmapping Overhead ..................... 86 3.3.8 Other Benchmarks ....................... 87 3.4 Related Work ............................. 88 3.4.1 The Compressor ........................ 89 3.4.2 The HotSpot Compactor .................... 90 3.4.3 The IBM Compactor ...................... 91 3.4.4 The Flood Compactor ..................... 91 3.4.5 The Pauseless GC ....................... 92 3.4.6 Virtual Memory Support for GC ................ 93 3.5 Summary and Conclusions ....................... 95 4 Dynamic Prediction of Collection Yield: Improving Intra-Runtime Mem- ory Management Performance Using Virtual Memory 97 4.1 Introduction and Motivation ...................... 98 4.2 Design and Implementation ...................... 101 4.2.1 Yield Predictor Design ..................... 102 4.2.2 Yield Prediction Process .................... 106 4.2.3 Implementation Details ...................