Presentation is loading. Please wait.

Presentation is loading. Please wait.

Age-Based Garbage Collection

Similar presentations


Presentation on theme: "Age-Based Garbage Collection"— Presentation transcript:

1 Age-Based Garbage Collection
Darko Stefanović, Kathryn McKinley, J. Eliot B. Moss OOPSLA ‘99 CS395T: Hadi Esmaeilzadeh February 2009

2 Outline Scavenging Generational Copying Collection (YO)
Runtime Overheads Older-First (OF) Write Barrier and Heap Organization Contributions Statistics

3 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? Non-generational: Degenerate case where U is empty Ideal case: we chose C such that S is empty Best heuristic: 1) Partitioning into C and U is trivial 2) S becomes small

4 Youngest-Only (YO) Intuition: Mortality rate is higher among young objects :((! Let C={Young objects} Objective: Minimize |S| Fewer survivors Copy less Track less

5 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? There is a trade-off between copying cost and pointer-tracking cost that can be exploited. Most pointer stores are among the young objects and by moving the collected region outside these youngest objects, GC (OF) must track more pointers However, OF lowers copying cost because it gives more time to die and does not collect the very youngest objects, which clearly have not had time to die.

6 Runtime Overheads: Early Tenuring (Promotion)
Newly objects are promoted … What a shame! They die! Waste of time, space, … What else? Power!

7 Why Generational Collection Works 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? Even though, the first statement is justified for functional programming languages, it is not generally true for OO programs Most stores are to objects that are very young, they install pointers to target that are also very young (whether relatively younger or older than the source) Kathryn’s

8 Older-First Garbage Collection
Many objects die when they are middle age! Give the poor young objects a chance to live!

9 Older-First Garbage Collection
Youngest Oldest Heap window Collection 1 survivors window Collection 2 survivors window Collection 3 survivors Kathryn’s

10 The Sweet Spot How do we allocate the new objects?

11 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 Degree of freedom or added complexity? Who can help? Small window sizes are desirable because they contribute to keeping the pause time short, which is especially important in interactive programs. If window size is small, GC might fail because the long lived data spans more than the collection window? Window motion policy Easy to implement and fast. However, we might be able to go back to the sweet spot somehow! We start from the point where up-front know that |S| will be large. Let’s jump to the middle, where we had the sweet spot. In generational GC there is a tension between, the need to increase the size of the nursery so as to reduce such wasteful copying of young objects, and the need to increase the size of older generations so that they are not collected frequently. Compiler may be able to provide hints for the runtime system. History-based approaches might be helpful.

12 Write Barrier: Pointer Filtering for Older-First
allocation oldest next collection youngest stored pointer, no store Runtime pointer direction filtering Do not record Pointers within the same block Pointers with source collected before target How can architecture help? Having an specific instruction for installing pointers. Kathryn’s

13 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

14 Total Cost JavaBYTEmark
Older-first is able to focus on an age range where wasteful copying is minimized, which result in good performance on those programs where such a range prominently exists. Kathryn’s

15 Total Cost Richards (Smalltalk)

16 Total Cost Bloat-Bloat
Kathryn’s

17 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

18 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 , 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 , February, 2008

19 Resources Ben Wiedermann’s presentation in 2003 class
Improving Memory Performance for Java, Kathryn McKinley, CRA-W Distinguished Lecture, ECE CMU, 2000,

20 Youngest Only GC Youngest Oldest Heap window uncollected Collection 1
survivors window uncollected Collection 2 survivors

21 Generational GC with 2 Generations
nursery Youngest Oldest Heap window reserve uncollected Collection 1 from reserve survivors freed uncollected window reserve Collection 2 from reserve survivors freed window Collection 3 reserve


Download ppt "Age-Based Garbage Collection"

Similar presentations


Ads by Google