age-based garbage collection
DESCRIPTION
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 - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/1.jpg)
Age-Based Garbage Collection
Darko Stefanović, Kathryn McKinley, J. Eliot B.
Moss
OOPSLA ‘99
CS395T: Hadi EsmaeilzadehFebruary 2009
![Page 2: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/2.jpg)
Outline
ScavengingGenerational Copying Collection (YO)Runtime OverheadsOlder-First (OF)Write Barrier and Heap OrganizationContributionsStatistics
![Page 3: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/3.jpg)
Scavenging
U={regions not collected}; assumed liveC={regions collected}
S={Survivors}G={Garbage}; copied/compacted
Work proportional to |S|CopyingPointer-tracking
What is the ideal case?What is the best heuristic?
![Page 4: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/4.jpg)
Youngest-Only (YO)
Intuition: Mortality rate is higher among young objects :((! Let C={Young objects}
Objective: Minimize |S|
Fewer survivorsCopy lessTrack less
QuickTime™ and a decompressor
are needed to see this picture.
![Page 5: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/5.jpg)
Runtime Overheads
Copying the survivorsTracking the pointers crossing the boundaries
In this case, only old-to-young pointersWrite barrier (interleaving pointer-tracking with program execution)
Cache: The place program and GC collide!Where is the trade-off?
QuickTime™ and a decompressor
are needed to see this picture.
![Page 6: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/6.jpg)
Runtime Overheads: Early Tenuring (Promotion)
Newly objects are promoted… What a shame! They die!
Waste of time, space, …What else?
QuickTime™ and a decompressor
are needed to see this picture.
![Page 7: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/7.jpg)
Why Generational CollectionWorks WellYoung 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
![Page 8: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/8.jpg)
Older-First Garbage Collection
Many objects die when they are middle age!Give the poor young objects a chance to live!
![Page 9: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/9.jpg)
Older-First Garbage Collection
Oldest Youngest
Heap
window Collection 1
Collection 2
Collection 3
survivors
window
window
survivors
survivors
Kathryn’s
![Page 10: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/10.jpg)
The Sweet Spot
![Page 11: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/11.jpg)
Design Decisions
Sliding window determines C (Collection region)
What is the design decision?What is the trade-off?Other alternatives?
Window hits the allocation pointCollect/compact objectsReset the window to the oldest objectsWhat is the design decision?What is the trade-off?Other alternatives?
Degree of freedom or added complexity?Who can help?
![Page 12: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/12.jpg)
Write Barrier: Pointer Filtering for Older-First
Runtime pointer direction filteringDo not record
Pointers within the same blockPointers with source collected before target
How can architecture help?
allocation
oldest youngestnext collection
stored pointer, no store
Kathryn’s
![Page 13: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/13.jpg)
Trace Based MeasurementsFully accurate tracesAll pointers between objectsPrecise object life times (collect after every allocation)
Measured costsCopying Write barrierRemembered set processing
Unmeasured effectsCache / locality interactionsStartup
What is the net speedup? Kathryn’s
![Page 14: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/14.jpg)
Total Cost JavaBYTEmark
0
0.5
1
1.5
2
2.5
200,000 260000 330000 390000
Heap size (words)
Total cost (cycles x
10^7)
Older-First 2 Generational
Kathryn’s
![Page 15: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/15.jpg)
Total Cost Richards (Smalltalk)
0123456
2,5002500 3000 3500 5200 6200 7800 9300
Heap size (words)
Total cost (cycles x
10^7)
Older-first 2 Generational
![Page 16: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/16.jpg)
Total Cost Bloat-Bloat
00.51
1.52
2.53
25000030000039000045000056000066000082000010000001300000
Heap size (words)
Total cost (cycles x
10^8)
Older-first 2 Generational
Kathryn’s
![Page 17: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/17.jpg)
Contributions
More accurate explanations of generational collection (My favorite :))!Significant reduction in copying cost, by trading off pointer maintenance costsNew write barrier mechanismsNew promising algorithm
Kathryn’s
![Page 18: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/18.jpg)
Citation Statistics
ACM portal: 28
Google scholar: 61Narendran Sachindran , J. Eliot , B. Moss, Mark-copy: fast copying GC with less space overhead, ACM SIGPLAN Notices, v.38 n.11, November 2003Feng 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, CanadaSebastien 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, CanadaWilliam 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 2006Feng 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
![Page 19: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/19.jpg)
Resources
Ben Wiedermann’s presentation in 2003 classImproving 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
![Page 20: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/20.jpg)
Youngest Only GCOldest Youngest
Heap
window Collection 1
Collection 2
survivors
survivors
window
uncollected
uncollected
![Page 21: Age-Based Garbage Collection](https://reader036.vdocuments.site/reader036/viewer/2022062500/568150bd550346895dbedaac/html5/thumbnails/21.jpg)
Generational GC with 2 GenerationsOldest Youngest
Heap
window Collection 1
Collection 2
survivors
survivors
window
reserve
uncollected
nursery
freed fromreserve
freed fromreserve
uncollected
Collection 3window
reserve
reserve