21 September 2005Rotor Capstone Workshop Parallel, Real-Time Garbage Collection Daniel Spoonhower Guy Blelloch, Robert Harper, David Swasey Carnegie Mellon.

Slides:



Advertisements
Similar presentations
An Implementation of Mostly- Copying GC on Ruby VM Tomoharu Ugawa The University of Electro-Communications, Japan.
Advertisements

Garbage collection David Walker CS 320. Where are we? Last time: A survey of common garbage collection techniques –Manual memory management –Reference.
Automatic Memory Management Noam Rinetzky Schreiber 123A /seminar/seminar1415a.html.
Lecture 10: Heap Management CS 540 GMU Spring 2009.
Memory Management Chapter 7.
MC 2 : High Performance GC for Memory-Constrained Environments - Narendran Sachindran, J. Eliot B. Moss, Emery D. Berger Sowmiya Chocka Narayanan.
Garbage Collection  records not reachable  reclaim to allow reuse  performed by runtime system (support programs linked with the compiled code) (support.
1 Error-Free Garbage Collection Traces: How to Cheat and Not Get Caught ACM SIGMETRICS, 2002.
Garbage Collection CSCI 2720 Spring Static vs. Dynamic Allocation Early versions of Fortran –All memory was static C –Mix of static and dynamic.
Beltway: Getting Around Garbage Collection Gridlock Mrinal Deo CS395T Presentation March 2, Content borrowed from Jennifer Sartor & Kathryn McKinley.
By Jacob SeligmannSteffen Grarup Presented By Leon Gendler Incremental Mature Garbage Collection Using the Train Algorithm.
MC 2 : High Performance GC for Memory-Constrained Environments N. Sachindran, E. Moss, E. Berger Ivan JibajaCS 395T *Some of the graphs are from presentation.
Increasing Memory Usage in Real-Time GC Tobias Ritzau and Peter Fritzson Department of Computer and Information Science Linköpings universitet
An Efficient Machine-Independent Procedure for Garbage Collection in Various List Structures, Schorr and Waite CACM August 1967, pp Curtis Dunham.
Chapter 8 Runtime Support. How program structures are implemented in a computer memory? The evolution of programming language design has led to the creation.
Memory Management. History Run-time management of dynamic memory is a necessary activity for modern programming languages Lisp of the 1960’s was one of.
1 The Compressor: Concurrent, Incremental and Parallel Compaction. Haim Kermany and Erez Petrank Technion – Israel Institute of Technology.
G Robert Grimm New York University Cool Pet Tricks with… …Virtual Memory.
0 Parallel and Concurrent Real-time Garbage Collection Part I: Overview and Memory Allocation Subsystem David F. Bacon T.J. Watson Research Center.
Generational Stack Collection And Profile driven Pretenuring Perry Cheng Robert Harper Peter Lee Presented By Moti Alperovitch
Connectivity-Based Garbage Collection Presenter Feng Xian Author Martin Hirzel, et.al Published in OOPSLA’2003.
Age-Oriented Concurrent Garbage Collection Harel Paz, Erez Petrank – Technion, Israel Steve Blackburn – ANU, Australia April 05 Compiler Construction Scotland.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Garbage Collection Without Paging Matthew Hertz, Yi Feng, Emery Berger University.
UniProcessor Garbage Collection Techniques Paul R. Wilson University of Texas Presented By Naomi Sapir Tel-Aviv University.
Garbage Collection Memory Management Garbage Collection –Language requirement –VM service –Performance issue in time and space.
A Parallel, Real-Time Garbage Collector Author: Perry Cheng, Guy E. Blelloch Presenter: Jun Tao.
Memory Management Last Update: July 31, 2014 Memory Management1.
SEG Advanced Software Design and Reengineering TOPIC L Garbage Collection Algorithms.
Flexible Reference-Counting-Based Hardware Acceleration for Garbage Collection José A. Joao * Onur Mutlu ‡ Yale N. Patt * * HPS Research Group University.
Exploiting Prolific Types for Memory Management and Optimizations By Yefim Shuf et al.
David F. Bacon Perry Cheng V.T. Rajan IBM T.J. Watson Research Center The Metronome: A Hard Real-time Garbage Collector.
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
Ulterior Reference Counting: Fast Garbage Collection without a Long Wait Author: Stephen M Blackburn Kathryn S McKinley Presenter: Jun Tao.
CY2003 Computer Systems Lecture 09 Memory Management.
Chapter 4 Storage Management (Memory Management).
A Mostly Non-Copying Real-Time Collector with Low Overhead and Consistent Utilization David Bacon Perry Cheng (presenting) V.T. Rajan IBM T.J. Watson Research.
Dynamic Object Sampling for Pretenuring Maria Jump Department of Computer Sciences The University of Texas at Austin Stephen M. Blackburn.
Copyright (c) 2004 Borys Bradel Myths and Realities: The Performance Impact of Garbage Collection Paper: Stephen M. Blackburn, Perry Cheng, and Kathryn.
Message Analysis-Guided Allocation and Low-Pause Incremental Garbage Collection in a Concurrent Language Konstantinos Sagonas Jesper Wilhelmsson Uppsala.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science 1 Automatic Heap Sizing: Taking Real Memory into Account Ting Yang, Emery Berger,
Computer Science Department Daniel Frampton, David F. Bacon, Perry Cheng, and David Grove Australian National University Canberra ACT, Australia
September 11, 2003 Beltway: Getting Around GC Gridlock Steve Blackburn, Kathryn McKinley Richard Jones, Eliot Moss Modified by: Weiming Zhao Oct
Investigating the Effects of Using Different Nursery Sizing Policies on Performance Tony Guan, Witty Srisa-an, and Neo Jia Department of Computer Science.
CS 241 Discussion Section (11/17/2011). Outline Review of MP7 MP8 Overview Simple Code Examples (Bad before the Good) Theory behind MP8.
1 Memory Management Chapter 7. 2 Memory Management Subdividing memory to accommodate multiple processes Memory needs to be allocated to ensure a reasonable.
CSE 425: Control Abstraction I Functions vs. Procedures It is useful to differentiate functions vs. procedures –Procedures have side effects but usually.
UniProcessor Garbage Collection Techniques Paul R. Wilson University of Texas Presented By Naomi Sapir Tel-Aviv University.
Immix: A Mark-Region Garbage Collector Curtis Dunham CS 395T Presentation Feb 2, 2011 Thanks to Steve Blackburn and Jennifer Sartor for their 2008 and.
David F. Bacon Perry Cheng V.T. Rajan IBM T.J. Watson Research Center ControllingFragmentation and Space Consumption in the Metronome.
A REAL-TIME GARBAGE COLLECTOR WITH LOW OVERHEAD AND CONSISTENT UTILIZATION David F. Bacon, Perry Cheng, and V.T. Rajan IBM T.J. Watson Research Center.
Consider Starting with 160 k of memory do: Starting with 160 k of memory do: Allocate p1 (50 k) Allocate p1 (50 k) Allocate p2 (30 k) Allocate p2 (30 k)
Introduction to Garbage Collection. Garbage Collection It automatically reclaims memory occupied by objects that are no longer in use It frees the programmer.
2/4/20161 GC16/3011 Functional Programming Lecture 20 Garbage Collection Techniques.
CS 241 Discussion Section (2/9/2012). MP2 continued Implement malloc, free, calloc and realloc Reuse free memory – Sequential fit – Segregated fit.
CS 241 Discussion Section (12/1/2011). Tradeoffs When do you: – Expand Increase total memory usage – Split Make smaller chunks (avoid internal fragmentation)
® July 21, 2004GC Summer School1 Cycles to Recycle: Copy GC Without Stopping the World The Sapphire Collector Richard L. Hudson J. Eliot B. Moss Originally.
The Metronome Washington University in St. Louis Tobias Mann October 2003.
CS412/413 Introduction to Compilers and Translators April 21, 1999 Lecture 30: Garbage collection.
GC Assertions: Using the Garbage Collector To Check Heap Properties Samuel Z. Guyer Tufts University Edward Aftandilian Tufts University.
Eliminating External Fragmentation in a Non-Moving Garbage Collector for Java Author: Fridtjof Siebert, CASES 2000 Michael Sallas Object-Oriented Languages.
Introduction to Garbage Collection. GC Fundamentals Algorithmic Components AllocationReclamation 2 Identification Bump Allocation Free List ` Tracing.
Immix: A Mark-Region Garbage Collector Jennifer Sartor CS395T Presentation Mar 2, 2009 Thanks to Steve for his Immix presentation from
Memory Management.
Segmentation COMP 755.
Ulterior Reference Counting Fast GC Without The Wait
David F. Bacon, Perry Cheng, and V.T. Rajan
Strategies for automatic memory management
Adaptive Code Unloading for Resource-Constrained JVMs
Virtual Memory Hardware
Chapter 12 Memory Management
Presentation transcript:

21 September 2005Rotor Capstone Workshop Parallel, Real-Time Garbage Collection Daniel Spoonhower Guy Blelloch, Robert Harper, David Swasey Carnegie Mellon University

Rotor Capstone Workshop2Parallel, Real-Time Garbage Collection21 September 2005 Motivation: Support Real-Time in C#  Real-time requires predictability  Focus on garbage collection in this work  Real-time collection must be:  predictable – allow programmers to reason about code  efficient – RT apps must meet deadlines  scalable – multi-threaded apps  multi-threaded GC

Rotor Capstone Workshop3Parallel, Real-Time Garbage Collection21 September 2005 Our Results Collector implementation available online  incremental GC w/ stacklets real-soon-now  C# benchmarks also available Published work in VEE ’05  using residency to balance GC tradeoffs  dynamically adapt to application behavior

Rotor Capstone Workshop4Parallel, Real-Time Garbage Collection21 September 2005 Outline of Talk  Implementing a real-time collector  incremental collection  challenges in Rotor  Using residency to balance GC tradeoffs  between copying and non-copying GC  semantic constraints (e.g. pinning)  use of space and time (i.e. overhead)

Rotor Capstone Workshop5Parallel, Real-Time Garbage Collection21 September 2005 Incremental Collection Divide collector work into small pieces  interleave collector execution with application  avoid long interruptions of application  divide call stack into fixed size stacklets  typical metric: (minimum) mutator utilization

Rotor Capstone Workshop6Parallel, Real-Time Garbage Collection21 September 2005 Minimum Mutator Utilization (MMU)

Rotor Capstone Workshop7Parallel, Real-Time Garbage Collection21 September 2005 Building on Previous Work We extend replicating copying collection  Nettles & O’Toole; Cheng & Blelloch  based on semi-space copying collection  good time bounds, high space overhead Rotor requires GC to support pinned objects  part of foreign function interface  determined by programmer Incompatible with pure copying GC!

Rotor Capstone Workshop8Parallel, Real-Time Garbage Collection21 September 2005 Outline of Talk 1.Implementing a real-time collector  incremental collection  challenges in Rotor  Using residency to balance tradeoffs  between copying and non-copying GC  semantic constraints (e.g. pinning)  use of space and time (i.e. overhead)

Rotor Capstone Workshop9Parallel, Real-Time Garbage Collection21 September 2005 Adaptive Hybrid Collection Bartlett: mostly copying collection  reduce fragmentation in constrained GC We extend this to uniformly account for:  pinned objects  large objects  densely populated pages

Rotor Capstone Workshop10Parallel, Real-Time Garbage Collection21 September 2005 Mostly Copying Collection “Copy objects...most of the time.” Key ideas:  divide heap into pages  determine strategy for each page dynamically: objects may be evacuated or promoted in place Gain benefits of both copying and non- copying collection

Rotor Capstone Workshop11Parallel, Real-Time Garbage Collection21 September 2005 Mostly Copying Collection divide heap into pages……reserve pages for allocation…...allocate objects……begin collection……flip……some objects are unreachable… …evacuate reachable objects……pinned……in-place promotion!... and reclaim unused space.

Rotor Capstone Workshop12Parallel, Real-Time Garbage Collection21 September 2005 Don’t Relocate Large Objects Large objects often relegated to separate heap ... because they are expensive to copy We use in-place promotion instead.  avoids usual penalties of copying large objects  no additional heap space required  use small objects to fill in gaps

Rotor Capstone Workshop13Parallel, Real-Time Garbage Collection21 September 2005 Don’t Relocate Large Objects They don’t cause (much) fragmentation  little benefit to moving them around Similarly for densely populated pages:  expensive to evacuate  little fragmentation vs.

Rotor Capstone Workshop14Parallel, Real-Time Garbage Collection21 September 2005 Page Residency as Guiding Principle Residency = density of reachable objects  avoid evacuating objects from dense pages  focus on fragmented parts of the heap Large objects occupy pages w/ high residency.  therefore, they are promoted in place

Rotor Capstone Workshop15Parallel, Real-Time Garbage Collection21 September 2005 Revisiting Allocation Copying collectors use simple space check  constant time when there is sufficient space  requires contiguous unused space In-place promotion requires more sophisticated management of free space.  need to find an free gap of appropriate size

Rotor Capstone Workshop16Parallel, Real-Time Garbage Collection21 September 2005 Overview of Our Hybrid Algorithm Collection strategy determined for each page Two data structures for heap traversal:  Cheney queues for evacuated objects  mark stack for objects promoted in place Allocation using a modified first-fit  favor free pages (treated as large gaps)  other free list algorithms also applicable

Rotor Capstone Workshop17Parallel, Real-Time Garbage Collection21 September 2005 Two Mechanisms to Reclaim Space Reclaim space both...  via evacuation use residency to determine which objects should be evacuated  during allocation use residency to determine which pages have enough space to make allocation worthwhile

Rotor Capstone Workshop18Parallel, Real-Time Garbage Collection21 September 2005 Collector Configurations Two residency parameters:  r evac = evacuation threshold, maximum residency at which objects are evacuated  r alloc = allocation threshold, maximum residency at which free space is reused (both measured as % of page) Classic algorithms fall out as special cases  semi-space: r evac = 100%, r alloc = 0%  mark-sweep: r evac = 0%, r alloc = 100%

Rotor Capstone Workshop19Parallel, Real-Time Garbage Collection21 September 2005 A Continuum of Configurations r evac = when objects are evacuated r alloc = when free space is reused

Rotor Capstone Workshop20Parallel, Real-Time Garbage Collection21 September 2005 Adaptive Hybrid Collection So far...  outlined a hybrid algorithm for garbage collection  shown how residency thresholds give rise to a continuum of configurations Next: how to determine residency...

Rotor Capstone Workshop21Parallel, Real-Time Garbage Collection21 September 2005 Measuring Residency Residency can be computed during a heap traversal at little additional cost. However, we need to know residency at beginning of collection...

Rotor Capstone Workshop22Parallel, Real-Time Garbage Collection21 September 2005 Use Past Measurements One possibility: explicitly measure residency during each collection (using an extra traversal). Instead, measure and predict future values  historical measurements avoid a second pass  measured residency still accounts for changes in program behavior over time

Rotor Capstone Workshop23Parallel, Real-Time Garbage Collection21 September 2005 Existing GCs Also Predict Residency Other hybrids fix residency estimates in advance.  syntactic properties to distinguish objects  e.g. size, type, allocation point Age: “Most objects die young.”  “Nursery is sparsely populated.”  i.e. using age to predict residency  however, generational collectors are often inconsistent in using age (e.g. large objects)

Rotor Capstone Workshop24Parallel, Real-Time Garbage Collection21 September 2005 Recovering from Poor Predictions Adaptive GC recovers naturally from poor predictions.  at most two collections to recover space  without changes to algorithm

Rotor Capstone Workshop25Parallel, Real-Time Garbage Collection21 September 2005 Recovering from Poor Predictions Consider the impact of overestimation:  many sparse pages remain – high fragmentation  measurements give true residency for each page  next collection will relocate objects to reclaim space GC with poor predictions behaves like an explicit measurement phase.  in effect, only corrects inaccurate estimates Allocation uses true residency, not predictions.  actual residency is known at the end of collection

Rotor Capstone Workshop26Parallel, Real-Time Garbage Collection21 September 2005 Experimental Results If we know usage patterns of an application in advance, we choose an appropriate algorithm.  adaptive hybrid GC relieves us of this choice Consider the impact of heap size on GC overhead  caveat: other effects of GC not shown here

Rotor Capstone Workshop27Parallel, Real-Time Garbage Collection21 September 2005 Impact of Heap Size Heap size = memory available to collector We expect copying collectors to perform well when there is plenty of space. For small heaps, semi-space collectors may not satisfy all allocation requests. Hybrid yields good performance in all cases.

Rotor Capstone Workshop28Parallel, Real-Time Garbage Collection21 September 2005 Impact of Heap Size

Rotor Capstone Workshop29Parallel, Real-Time Garbage Collection21 September 2005 Impact of Heap Size

Rotor Capstone Workshop30Parallel, Real-Time Garbage Collection21 September 2005 Other Measurements Same configuration performs well in many different environments  different applications  small and large footprints (100 kB to 100 MB)

Rotor Capstone Workshop31Parallel, Real-Time Garbage Collection21 September 2005 Related Work  Replicating Collection – Nettles & O’Toole; Cheng & Blelloch  Mostly Copying – Bartlett; Smith & Morrisett  Garbage First – Detlefs, Flood, Heller, & Printezis (also uses residency as a measure of cost)  Metronome – Bacon, Cheng, & Rajan (different point in the “mostly” design space)

Rotor Capstone Workshop32Parallel, Real-Time Garbage Collection21 September 2005 Summary Incremental collection  divide up collector work over time Adaptive hybrid collection  use page residency to guide runtime decisions  continuous spectrum of tracing collectors Measure and adapt to application behavior  predict residency based on past measurements  naturally recovers from poor estimates

Rotor Capstone Workshop33Parallel, Real-Time Garbage Collection21 September 2005 Useful Links VEE ’05 paper: Collector implementation: C# benchmarks: