290 likes | 300 Views
Discussing the age-oriented concurrent garbage collection approach and its advantages in modern environments with multiprocessors and large memories. Covers properties, implementation, measurements, and conclusion.
E N D
Age-Oriented Concurrent Garbage Collection Harel Paz, Erez Petrank – Technion, Israel Steve Blackburn – ANU, Australia April 05 Compiler Construction Scotland
Garbage Collection • User allocates space dynamically, the garbage collector automatically frees the space when it no longer reachable by a path of pointers from program local references (roots). • Programmer does not have to decide when to free an object. (Memory leaks, dangling pointers.) • Built into Java, C#. Compiler Construction, April 2005
Garbage Collection Today • Today’s advanced environments: • multiprocessors + large memories Dealing with multiprocessors Single-threaded stop the world Compiler Construction, April 2005
Garbage Collection Today • Today’s advanced environments: • multiprocessors + large memories Dealing with multiprocessors Parallel collection Concurrent collection High throughput Short pauses Compiler Construction, April 2005
Outline • Garbage collection and modern platforms • Properties of classical algorithms • Generational garbage collection • Age-oriented collection • Implementation, measurements • Conclusion Compiler Construction, April 2005
Garbage Collection Two Classical Approaches Tracing [McCarthy 1960]: trace reachable objects, reclaim objects not traced. Reference counting [Collins 1960]: keep a reference count for each object, reclaim objects with count 0. • Complexity: • traversal of live objects • (sweep is typically fast) • Complexity: • tracking pointer modific’s • traversal of dead objects Compiler Construction, April 2005
Choosing a Collector Tracing: Best when most objects dead. Reference counting Best when most objects alive, and low “activity”. When are objects typically dead? The generational hypothesis: most objects die young. Compiler Construction, April 2005
Generational Garbage Collection [Lieberman-Hewitt 83, Ungar 84]: • Segregate objects by age into generations. • Objects allocated in the young generation, promoted into the old generation if they survive long enough. • Frequently collect the young generation • Collect full heap when needed. Old Young • Most pauses are short (for young generation GC). • Collection effort concentrated where garbage is. Compiler Construction, April 2005
Note Interesting Characteristics • Young generation: most objects die & high activity.Tracing is best when most objects die. • Old generation: most objects alive and slow activity.Reference counting is best. • Conclusion: use RC for old & tracing for young. • Already done by [Azatchi-Petrank CC’03][Blackburn-Mckinley OOPSLA’03] Compiler Construction, April 2005
Size of Young Generation • small young generation (mostly) short pauses large young generation high efficiency • Appel’s collector uses a large young generation and obtains highest efficiency. Compiler Construction, April 2005
Observation 1 large young generation high efficiency but long pauses concurrent collector short pauses Observation 1: we want the largest possible young generation. Compiler Construction, April 2005
Observation 2 Delaying collection of the old generation is fundamentally tracing-oriented. Complexity of tracing is fixed: delay it. Complexity of RC accumulates (update counters, traverse the unreachable) no use in delaying it. Compiler Construction, April 2005
Observation 2 Delaying collection of the old generation is fundamentally tracing-oriented. We use RC for old generation Observation 2: No use in delaying collection of old objects. Compiler Construction, April 2005
Conclusion Observation 1: we want the largest possible young generation. Observation 2: no use in delaying collection of old objects. Conclusion (age-oriented collection): collect entire heap with each collection Compiler Construction, April 2005
Age-Oriented vs. Generational • Age-Oriented • Always collect entire heap • Collect each generation differently • Generational • Frequently collect young generation • Collect young generation and full heap differently Compiler Construction, April 2005
Generational vs. Age-Oriented Old Old Old Old Old Standard: Young Young Young Young Young time Old Old Old Young Old Old Age- Oriented: Young Young Young Young Young Young Compiler Construction, April 2005
Age-Oriented Properties Advantages: • Largest possible young generation. • No frequent young collections. • Each generation is treated according to its characteristics (like generational collectors). • Potentially easier to obtain inter-generat’l ptr’s. Young Generation Old Generation B A Compiler Construction, April 2005
Age-Oriented Properties Advantages: • Largest possible young generation. • No frequent young collections. • Each generation is treated according to its characteristics (like generational collectors). • Potentially easier to obtain inter-generat’l ptr’s. Disadvantages: • Longer pauses (if we don’t use concurrent GC.) • May have a throughput penalty if tracing the old generation (not an issue for RC). Compiler Construction, April 2005
Age-Oriented Collection • Age-Oriented • Always collect entire heap • Collect each generation differently A general framework: instantiated by picking collectors for the old and young generations and combining them. Compiler Construction, April 2005
Our Instantiation • Building blocks: the sliding views collectors [Levanoni-Petrank 01, Azatchi et al. 03] • Old generation: concurrent RC. • Young generation: concurrent tracing. • Technicalities: • Joining the two collectors • Inter-generational pointers Compiler Construction, April 2005
Implementation • Implementation for Java on the Jikes Research JVM • Compared collectors: • RC with no generation. • Generational: tracing for young & RC for full. • Benchmarks: • SPECjbb2000: simulates business-like trans’s. • SPECjvm98: client benchmarks suite. • Platform: a 4-Way Netfinity. Compiler Construction, April 2005
Pause Times vs. STW Compiler Construction, April 2005
SPECjbb Throughput (Age-Oriented vs. RC) Compiler Construction, April 2005
SPECjbb Throughput (Generational vs. RC) Compiler Construction, April 2005
SPECjvm98 Throughput (Age-Oriented vs. RC) Compiler Construction, April 2005
Throughput versus Parallel Tracing Compiler Construction, April 2005
Related Work • [Azatzhi-Petrank CC’03] Concurrent generations with RC for full and tracing for young. (Very short pauses.) • [Blackburn-Mckinley OOPSLA’03]Generations with RC for old and tracing for young. Non concurrent but controlled pauses. • [Paz et al. CC’05] (coming soon…)Cycle Collection --- better do it only for old objects, via age-oriented collection. • RC: some recent breakthrough, still work needed to get RC “right” for modern platforms. Compiler Construction, April 2005
Concurrent & Generational GC • A general question for concurrent collectors: • Concurrent collectors already have short pauses, should we also use generations ? • First experiment [Domani et al. PLDI’00]: • Beneficial, but unsteady improvements (-8% -- 25%). • Base was production JVM with mark & sweep. • Second experiment: [Azatchi-Petrank, CC’03]: • Beneficial, 10-20% improvement. • Base was Jikes RVM with RC. • Third try: Mostly Concurrent [ISMM’00, PLDI’02, OOPSLA’03]: • SUN: yes, no measurements. • IBM: no, (and no measurements). • Fourth experiment: this work… Compiler Construction, April 2005
Conclusion • The Age-Oriented collector improves efficiency of generational collectors • Especially with RC on old. • Especially with concurrent collectors. • It is a framework, we tried an instantiation with: • Concurrent RC for old, concurrent tracing for young. • The age-oriented collector was non-obtrusive (due to concurrency) and efficient (due to age-oriented) collector. • An excellent way to employ RC. Compiler Construction, April 2005