190 likes | 355 Views
Immix: A Mark-Region Garbage Collector. Jennifer Sartor CS395T Presentation Mar 2, 2009. Contributions. Another family of collectors: Mark-Region Immix has all of: space e fficiency, fast c ollection, and m utator performance Bump allocation Locality
E N D
Immix: A Mark-Region Garbage Collector Jennifer Sartor CS395T Presentation Mar 2, 2009 Thanks to Steve for his Immix presentation from 2008.
Contributions • Another family of collectors: Mark-Region • Immix has all of: space efficiency, fast collection, and mutator performance • Bump allocation • Locality • Opportunistic defragmentation, mark+copy in single pass Thanks to Steve for his Immix presentation from 2008.
GC FundamentalsAlgorithmic Components Identification Allocation Reclamation ` Sweep-to-Free Tracing (implicit) Free List Compact Reference Counting (explicit) Bump Allocation Evacuate 3 1 Thanks to Steve for his Immix presentation from 2008.
GC FundamentalsCanonical Garbage Collectors Mark-Sweep [McCarthy 1960] Free-list + trace + sweep-to-free ` Sweep-to-Free Compact Mark-Compact [Styger 1967] Bump allocation + trace + compact Evacuate Semi-Space [Cheney 1970] Bump allocation + trace + evacuate Thanks to Steve for his Immix presentation from 2008.
Sweep-To-Regionand Mark-Region Reclamation Sweep-to-Free Mark-Sweep Free-list + trace + sweep-to-free ` Compact Mark-Compact Bump allocation + trace + compact Evacuate Semi-Space Bump allocation + trace + evacuate Mark-Region Bump alloc + trace + sweep-to-region Sweep-to-Region Thanks to Steve for his Immix presentation from 2008.
Compared to Existing Collectors Thanks to Steve for his Immix presentation from 2008.
Naïve Mark-Region • Contiguous allocation into regions • Excellent locality • For simplicity, objects cannot span regions • Simple mark phase (like mark-sweep) • Mark objects and their containing region • Unmarked regions can be freed 0 Thanks to Steve for his Immix presentation from 2008.
Heap Organization • Blocks • Recyclable • Immix block = 32KB • Lines • Objects can span lines • Immix line = 128B • Opportunistic defragmentation • Candidate and target blocks • Single pass to mark and copy Thanks to Steve for his Immix presentation from 2008.
Immix: Lines and Blocks ✓More contiguous allocation Large Regions ✗ Increased metadata o/h ✗ Constrained object sizes ✗ Fragmentation (false marking) Small Regions Lines & Blocks N pages approx 1 cache line Free Recyclable Free Recyclable 0 TLB locality, cache locality Block > 4 X max object size Objects span lines Lines marked with objects ✗ Fragmentation (can’t fill blocks) ✓Less fragmentation ✓Fast common case Thanks to Steve for his Immix presentation from 2008.
Allocation Policy(Recycling) • Recycle partially marked blocks first • Minimize fragmentation • Maximize sharing of freed blocks • Recycle in address order • We explored other options • Allocate into free blocks last Effect on locality and fragmentation? Thanks to Steve for his Immix presentation from 2008.
Opportunistic Defragmentation • Identify source and target blocks • (see paper for heuristics) • Evacuate objects in source blocks • Allocate into target blocks • Opportunistic • Leave in place if no space, or object pinned • Opportunistically evacuate fragmented blocks • Lightweight, uses same allocation mechanism • No cost in common case (specialized GC) 0 • Source = most holes • Other heuristics? Thanks to Steve for his Immix presentation from 2008.
Details • Parallelizable • Coarse sweeping • Defragmentation • Demand-driven overflow allocations • Medium objects • Metadata space overheads • For parallel synch: mark bytes (not bits) • Line and block mark, not just object mark • Defragmentation headroom • Overflow allocation block • Conservative line marking Thanks to Steve for his Immix presentation from 2008.
Other Optimizations ✓Most objects small Small objects implicitly mark next line Line mark ✓V. Fast common case Implicit line mark Large objects mark lines exactly Overflow Allocation Implicit Marking ✓ Multi-line objects may skip many small holes Overflow allocation (used on failure) ✓Large objects uncommon ✓V. effective solution Thanks to Steve for his Immix presentation from 2008.
Mark-Region: Immix(Bump Allocation + Trace + Sweep-to-Region) Good locality Space efficient ✓ ✓ Excellent performance ✓ Simple, very fast collection ✓ Actual data, taken from geomean of DaCapo, jvm98, and jbb2000 on 2.4GHz Core 2 Duo Thanks to Steve for his Immix presentation from 2008.
Minimum Heap Thanks to Steve for his Immix presentation from 2008.
Sticky Performance Benefits of Sticky? Geomean of DaCapo, jvm98 and jbb2000 on 2.4GHz Core 2 Duo Thanks to Steve for his Immix presentation from 2008.
Discussion • Compare to Beltway! • Increments & belts vs. lines & blocks • Both: reduce space util, good locality • Differences: incrementality and copying • Compare to MC2 • Caching/paging? • Do tuned line/block sizes work? • What is missing in experimental results? • Heap utilization? Thanks to Steve for his Immix presentation from 2008.
ImmixEfficient Mark-Region Garbage Collection Thanks to Steve for his Immix presentation from 2008.
Total Performance Geomean of DaCapo, jvm98 and jbb2000 on 2.4GHz Core 2 Duo Thanks to Steve for his Immix presentation from 2008.