210 likes | 338 Views
Age-Based Garbage Collection. Darko Stefanović, Kathryn McKinley, J. Eliot B. Moss OOPSLA ‘99 CS395T: Hadi Esmaeilzadeh February 2009. Outline. Scavenging Generational Copying Collection (YO) Runtime Overheads Older-First (OF) Write Barrier and Heap Organization Contributions
E N D
Age-Based Garbage Collection Darko Stefanović, Kathryn McKinley, J. Eliot B. Moss OOPSLA ‘99 CS395T: Hadi Esmaeilzadeh February 2009
Outline • Scavenging • Generational Copying Collection (YO) • Runtime Overheads • Older-First (OF) • Write Barrier and Heap Organization • Contributions • Statistics
Scavenging • U={regions not collected}; assumed live • C={regions collected} • S={Survivors} • G={Garbage}; copied/compacted • Work proportional to |S| • Copying • Pointer-tracking • What is the ideal case? • What is the best heuristic?
Youngest-Only (YO) • Intuition: Mortality rate is higher among young objects :((! • Let C={Young objects} • Objective: Minimize |S| • Fewer survivors • Copy less • Track less
Runtime Overheads • Copying the survivors • Tracking the pointers crossing the boundaries • In this case, only old-to-young pointers • Write barrier (interleaving pointer-tracking with program execution) • Cache: The place program and GC collide! • Where is the trade-off?
Runtime Overheads: Early Tenuring (Promotion) • Newly objects are promoted • … What a shame! They die! • Waste of time, space, … • What else?
Why Generational CollectionWorks Well Young objects die more quickly than old objects “generational hypothesis” [Unger’84,Hayes’91] Most pointers are from younger to older objects [Appel’89, Zorn’90] Do they apply to object oriented programs? Kathryn’s
Older-First Garbage Collection • Many objects die when they are middle age! • Give the poor young objects a chance to live!
Older-First Garbage Collection Youngest Oldest Heap window Collection 1 survivors Collection 2 window survivors window Collection 3 survivors Kathryn’s
Design Decisions • Sliding window determines C (Collection region) • What is the design decision? • What is the trade-off? • Other alternatives? • Window hits the allocation point • Collect/compact objects • Reset the window to the oldest objects • What is the design decision? • What is the trade-off? • Other alternatives? • Degree of freedom or added complexity? • Who can help?
Write Barrier: Pointer Filtering for Older-First Runtime pointer direction filtering • Do not record • Pointers within the same block • Pointers with source collected before target • How can architecture help? allocation oldest next collection youngest stored pointer, no store Kathryn’s
Trace Based Measurements Fully accurate traces • All pointers between objects • Precise object life times (collect after every allocation) Measured costs • Copying • Write barrier • Remembered set processing Unmeasured effects • Cache / locality interactions • Startup What is the net speedup? Kathryn’s
Total Cost JavaBYTEmark Kathryn’s
Total Cost Bloat-Bloat Kathryn’s
Contributions • More accurate explanations of generational collection (My favorite :))! • Significant reduction in copying cost, by trading off pointer maintenance costs • New write barrier mechanisms • New promising algorithm Kathryn’s
Citation Statistics • ACM portal: 28 • Google scholar: 61 • Narendran Sachindran , J. Eliot , B. Moss, Mark-copy: fast copying GC with less space overhead, ACM SIGPLAN Notices, v.38 n.11, November 2003 • Feng Xian , Witawas Srisa-an , Hong Jiang, Allocation-phase aware thread scheduling policies to improve garbage collection performance, Proceedings of the 6th international symposium on Memory management, October 21-22, 2007, Montreal, Quebec, Canada • Sebastien Marion , Richard Jones , Chris Ryder, Decrypting the Java gene pool, Proceedings of the 6th international symposium on Memory management, October 21-22, 2007, Montreal, Quebec, Canada • William D. Clinger , Fabio V. Rojas, Linear combinations of radioactive decay models for generational garbage collection, Science of Computer Programming, v.62 n.2, p.184-203, 1 October 2006 • Feng Xian , Witawas Srisa-an , Hong Jiang, Garbage collection: Java application servers' Achilles heel, Science of Computer Programming, v.70 n.2-3, p.89-110, February, 2008
Resources • Ben Wiedermann’s presentation in 2003 class • Improving Memory Performance for Java, Kathryn McKinley, CRA-W Distinguished Lecture, ECE CMU, 2000, http://amp.ece.cmu.edu/eceseminar/2000/Fall/Abstract/F00_McKinley.htm
Youngest Only GC Youngest Oldest Heap window Collection 1 uncollected survivors window Collection 2 uncollected survivors
Generational GC with 2 Generations Youngest nursery Oldest Heap window Collection 1 reserve uncollected from reserve survivors freed uncollected window Collection 2 reserve from reserve survivors freed window Collection 3 reserve