Upload
grover
View
35
Download
1
Embed Size (px)
DESCRIPTION
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 - PowerPoint PPT Presentation
Citation preview
Thanks to Steve for his Immix presentation from 2008.
1
Immix: A Mark-Region Garbage Collector
Jennifer SartorCS395T Presentation
Mar 2, 2009
Thanks to Steve for his Immix presentation from 2008.
2
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.
3
GC FundamentalsAlgorithmic Components
Allocation ReclamationIdentification
Bump Allocation
Free List
`
Tracing(implicit)
Reference Counting(explicit)
Sweep-to-Free
Compact
Evacuate
3 1
4
Mark-Compact [Styger 1967]
Bump allocation + trace + compact
GC FundamentalsCanonical Garbage Collectors
`
Sweep-to-Free
Compact
Evacuate
Mark-Sweep [McCarthy 1960]
Free-list + trace + sweep-to-free
Semi-Space [Cheney 1970]
Bump allocation + trace + evacuate
Thanks to Steve for his Immix presentation from 2008.
5
Sweep-To-Regionand Mark-Region
`
Sweep-to-Free
Compact
Evacuate
Reclamation
Sweep-to-Region
Mark-SweepFree-list + trace + sweep-to-free
Mark-CompactBump allocation + trace + compact
Semi-SpaceBump allocation + trace + evacuate
Mark-RegionBump alloc + trace + sweep-to-region
Thanks to Steve for his Immix presentation from 2008.
6
Compared to Existing CollectorsCollector Space
EfficiencyFast
CollectionMutator
PerformanceReclamation
Mark-Sweep
X X Sweep-to-free
Semi-Space
X X Evacuation
Mark-Compact
X X Compaction
Mark-Region
X X X Sweep-to-region
Thanks to Steve for his Immix presentation from 2008.
7
Naïve Mark-Region
• Contiguous allocation into regionsExcellent 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.
8
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.
9
Immix: Lines and Blocks
Small Regions
Large Regions
✗ Fragmentation (can’t fill blocks)
✓ More contiguous allocation ✗ Fragmentation (false marking)
Lines & BlocksN pages approx 1 cache line
✓ Less fragmentation Objects span lines
✓ Fast common case Lines marked with objects
✗ Increased metadata o/h
✗ Constrained object sizes
0
TLB locality, cache locality Block > 4 X max object size
Free FreeRecyclable Recyclable
Thanks to Steve for his Immix presentation from 2008.
10
Allocation Policy(Recycling)
• Recycle partially marked blocks firstMinimize fragmentationMaximize sharing of freed blocks
• Recycle in address order– We explored other options
• Allocate into free blocks lastEffect on locality and fragmentation?
Thanks to Steve for his Immix presentation from 2008.
11
Opportunistic Defragmentation
0
• 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)
• Source = most holes• Other heuristics?
Thanks to Steve for his Immix presentation from 2008.
12
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.
13
Other Optimizations
Implicit Marking
✓ Most objects small Small objects implicitly mark next line✓ V. Fast common case Large objects mark lines exactly Implicit line mark
Line mark
Overflow Allocation
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.
14
Garbage Collection
Space
Tim
e
Total Performance
MarkSweepMarkCompactSemiSpaceImmix
Space
Tim
e
Mark-Region: Immix(Bump Allocation + Trace + Sweep-to-Region)
Mutator
Space
Tim
e
Minimum Heap
Spac
e
✓Simple, very
fast collection
✓Space
efficient
✓Good
locality
Actual data, taken from geomean of DaCapo, jvm98, and jbb2000 on 2.4GHz Core 2 Duo
✓Excellent
performance
Thanks to Steve for his Immix presentation from 2008.
15
Minimum Heap
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.61111111111111 3.0377358490566
MarkSweep MarkCompact SemiSpace Immix
Thanks to Steve for his Immix presentation from 2008.
16
Sticky Performance
Geomean of DaCapo, jvm98 and jbb2000 on 2.4GHz Core 2 Duo
1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 61
1.05
1.1
1.15
1.2
1.25
StickyMS StickyIX GenMS (Production)
Heap Size (Normalized)
Tota
l Tim
e (N
orm
alize
d)
Benefits of Sticky?
Thanks to Steve for his Immix presentation from 2008.
17
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.
18
ImmixEfficient Mark-Region Garbage Collection
Thanks to Steve for his Immix presentation from 2008.
19
Total Performance
Geomean of DaCapo, jvm98 and jbb2000 on 2.4GHz Core 2 Duo
1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 61
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
2
MarkSweep MarkCompact SemiSpace Immix
Heap Size (Normalized)
Tota
l Tim
e (N
orm
alize
d)