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

Age-Based Garbage Collection

  • Upload
    elisa

  • View
    44

  • Download
    0

Embed Size (px)

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 Presentation

Citation preview

Page 1: Age-Based Garbage Collection

Age-Based Garbage Collection

Darko Stefanović, Kathryn McKinley, J. Eliot B.

Moss

OOPSLA ‘99

CS395T: Hadi EsmaeilzadehFebruary 2009

Page 2: Age-Based Garbage Collection

Outline

ScavengingGenerational Copying Collection (YO)Runtime OverheadsOlder-First (OF)Write Barrier and Heap OrganizationContributionsStatistics

Page 3: Age-Based Garbage Collection

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

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

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

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

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

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

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

The Sweet Spot

Page 11: Age-Based Garbage Collection

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

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

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

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

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

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

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

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

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

Youngest Only GCOldest Youngest

Heap

window Collection 1

Collection 2

survivors

survivors

window

uncollected

uncollected

Page 21: Age-Based Garbage Collection

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