generational generational garbage collection garbage
play

Generational Generational Garbage Collection Garbage Collection - PowerPoint PPT Presentation

Generational Generational Garbage Collection Garbage Collection Mirko Jerrentrup, Jerrentrup@interactive-software.de Overview Overview motivation at a glance issues problems and limitations conclusion Motivation


  1. Generational Generational Garbage Collection Garbage Collection Mirko Jerrentrup, Jerrentrup@interactive-software.de

  2. Overview Overview • motivation • at a glance • issues • problems and limitations • conclusion

  3. Motivation Motivation „classical“, e.g. copying GC: • no improvement of locality • repeated handling of long-lived objects

  4. The weak generational hypothesis The weak generational hypothesis „Most objects die young.“ • partition objects into generations • partition objects into generations • special handling of young objects: • special handling of young objects: → reduced pause times → reduced pause times → better collection efficiency → better collection efficiency [Ungar, 1984]

  5. Generational garbage collection Generational garbage collection • objects partitioned into multiple generations • young generation frequently collected (minor collection) • old generation seldomly collected (major collection) • surviving young objects promoted into old generation

  6. Example: Example : minor minor collection collection root set root set for root set for minor collection minor collection old generation young generation Inter-generational pointer root set Inter-generational pointer live nodes „garbage“ nodes old generation young generation

  7. Issues in Issues in generational garbage collection generational garbage collection generational garbage collection generational garbage collection promotion promotion heap organization heap organization inter-generational scheduling scheduling inter-generational pointers pointers

  8. generational garbage collection generational garbage collection promotion promotion heap organization heap organization scheduling inter-generational scheduling inter-generational pointers pointers

  9. Promotion Promotion early promotion late promotion long-living objects worse better short-living objects worse better time

  10. Promotion policies Promotion policies Promotion policies Promotion policies fixed adaptive fixed adaptive demographic feedback- Appel‘s collector for SML/NJ mediated tenuring

  11. Appel‘s Appel ‘s collector for collector for SML/NJ (1) SML/NJ (1) Idea: manage promotion rates by fixing heap occupancy of young objects • two generations, very large young generation • major collections only if old objects occupy half size of heap • precondition: contigious heap [Appel, 1989]

  12. Appel‘s Appel ‘s collector for collector for SML/NJ (2) SML/NJ (2) equal size old reserve free old reserve new old reserve free svr half heap size old free svr free free old´ svr old reserve free equal size

  13. Demographic feedback feedback- -mediated tenuring mediated tenuring (1) (1) Demographic Idea: promote only when necessary to hold maximum pause time • only promote if pause time will be acceptable • generate space-age table • promote only as many objects to make pause time acceptable [Ungar, Jackson 1992]

  14. Demographic feedback feedback- -mediated tenuring mediated tenuring (2) (2) Demographic young generation free free 150 bytes maximum acceptable pause time survivors survivors No promotion at next promotion of 150 bytes collection „oldest“ objects age size of age group number of number of survived survived 1 300 bytes collections collections 2 200 bytes 3 100 bytes size of objects size of objects in age group in age group [Ungar, Jackson 1992]

  15. generational garbage collection generational garbage collection promotion promotion heap organization heap organization scheduling inter-generational scheduling inter-generational pointers pointers

  16. Heap organization Heap organization Determination of object‘s generation • copying collectors: subheaps for generation contigious heaps → object adress non-contigious heaps → header field or page-table • non-copying collectors → header field

  17. Heap organization schemes Heap organization schemes heap organization schemes heap organization schemes creation space creation space „high water mark“ bucket system „high water mark“ bucket system

  18. Creation space Creation space (1) (1) Goals: • no large semi-spaces • improve locality Organization of a generation: • (small) aging area in two semi-spaces • (large) new object area in one creation space [Ungar, 1984]

  19. Creation space Creation space (2) (2) generation occupancy creation space aging semi- spaces time gc pause [Ungar, 1984]

  20. „High water mark „High water mark“ “ bucket bucket system (1) system (1) Goals: • avoid age field in object header • adaptive promotion threshold Organization of generations: • creation and aging spaces per generation • two buckets per generation • creation space partly holds first bucket • high water mark seperates buckets [Wilson, Moher 1989]

  21. „High water mark „High water mark“ “ bucket bucket system (2) system (2) heap occupancy bucket 1 high water mark younger generation bucket 2 next generation time [Wilson, Moher 1989]

  22. „High water mark „High water mark“ “ bucket bucket system ( system (3 3) ) „high water mark” effect: • objects from bucket 2 are promoted into older generation • objects from bucket 1 are stored in bucket 2 • „high water mark“ position determines promotion threshold • promotion threshold between 1 and 2 [Wilson, Moher 1989]

  23. generational garbage collection generational garbage collection promotion promotion heap organization heap organization scheduling inter-generational scheduling inter-generational pointers pointers

  24. Collection scheduling Collection scheduling Perform collection when : • pause is not interruptive hide collection from user hide collection from user • large amount of garbage efficent collection efficent collection can be expected

  25. Efficient collections Efficient collections Key (large) objects : • objects whose „death“ produces much garbage (root of a large tree etc.) • exclude key objects from generational scheme • store key objects „descendants“ in special large object area • reclaiming of key objects trigger collection in key area [Hayes 1991]

  26. Efficient collections – Efficient collections – key objects key objects (1) (1) root set key object key object young generation [Hayes 1991]

  27. Efficient collections – Efficient collections – key objects key objects (2) (2) root set key objects young generation keyed area [Hayes 1991]

  28. generational garbage collection generational garbage collection promotion promotion heap organization heap organization inter-generational scheduling inter-generational scheduling pointers pointers

  29. Inter- Inter -generational pointers generational pointers root set root set for root set for young generation young generation young generation old generation Issues: Inter-generational pointer Inter-generational pointer • detecting creation • including into root set upon collection • cost of detection / inclusion

  30. Inter- Inter -generational pointer handling generational pointer handling inter-generational pointer handling inter-generational pointer handling detection / storing of inter- detection / storing of inter- generational pointers generational pointers detecting individual marking pointer- detecting individual marking pointer- pointers containing areas pointers containing areas • pointer indirection page / word / card marking • remembered sets

  31. Detection Detection Detection of inter-generational pointers: • trapping pointer stores • only necessary to check objects in old generation(s) • generally: only non-initializing stores write-barrier write-barrier

  32. Individual pointers – Individual pointers – entry entry table table Idea: indirect pointers through an entry table generation 2 generation 1 generation 0 [Liebermann, Hewitt 1983]

  33. Individual pointers – Individual pointers – entry entry table table Idea: indirect pointers through an entry table generation 2 generation 1 generation 0 entry table entry table time space all pointers in the entry table small constant O(#stores), are added to the root set trapping stores (by mutator) for every store small constant inter-generationalpointer- N/A O(#stores) handling at collection time [Liebermann, Hewitt 1983]

  34. Individual pointers – Individual pointers – remembered set remembered set Idea: remember objects with old-young pointers old generation young generation no duplicate entries in set due time space to bit in object header pointer- small constant trapping stores (by mutator) O(# ) containers for every store Objects are scanned for pointers: pointer- inter-generationalpointer- N/A O(# ) O(size of objects) containers handling at collection time [Ungar 1984]

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend