unified theory of garbage collection

Download Unified Theory of Garbage Collection

Post on 30-Nov-2014

1.603 views

Category:

Spiritual

8 download

Embed Size (px)

DESCRIPTION

Seminar Talk by Yoshimi Takano

TRANSCRIPT

  • 1. A Unied Theory of Garbage Collection David F. Bacon Perry Cheng V.T. Rajan IBM Watson Research Center Seminar Talk by Yoshimi Takano, ETH ZurichA Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 1
  • 2. He who loves practice without theory is like the sailor who boards ship without a rudder and compass and never knows where he may cast. Leonardo da VinciA Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 2
  • 3. A Unied Theory of Garbage Collection David F. Bacon Perry Cheng V.T. Rajan IBM Watson Research CenterA Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 3
  • 4. Summary Tracing and reference counting are duals All high-performance garbage collectors are hybrids of tracing and reference counting This taxonomy can be used To develop a uniform cost-model As an algorithm design framework To generate collectors dynamically. . . A Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 4
  • 5. Outline Introduction Garbage Collection Motivation Duality of Tracing and Reference Counting Qualitative Comparison Abstract Garbage Collection Convergence Collection as Tracing and Reference Counting Single Heap Split Heap Uniform Cost Model A Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 5
  • 6. Introduction Garbage CollectionGarbage Collection and Liveness (Recap) Automatic storage reclamation of unreachable objects Roots: Globals Locals in stack frames Live Dead Roots A Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 6
  • 7. Introduction MotivationPicking a Garbage Collector for your VM Lots and lots of garbage collector algorithms State of the Art Implement n algorithms Measure and compare for m benchmarks Use algorithm with best mean performance Problems Limited exploration of design space (no compass) Static selection can sacrice performance[Slide from OOPSLA presentation] A Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 7
  • 8. Introduction MotivationPicking a Garbage Collector for your VM Lots and lots of garbage collector algorithms State of the Art Implement n algorithms Measure and compare for m benchmarks Use algorithm with best mean performance Problems Limited exploration of design space (no compass) Static selection can sacrice performance[Slide from OOPSLA presentation] A Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 7
  • 9. Duality of Tracing and Reference Counting Qualitative ComparisonTwo Fundamental Garbage Collection Techniques Tracing [McCarthy, 1960] Stop the world Trace forward from roots Everything touched is live, all else is garbage Reference Counting [Collins, 1960] Each object has count of incoming pointers Adjust count in case of mutations (write barrier) When counter reaches zero, object is garbage and count of all children is decremented A Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 8
  • 10. Duality of Tracing and Reference Counting Qualitative ComparisonTwo Fundamental Garbage Collection Techniques Tracing [McCarthy, 1960] Stop the world Trace forward from roots Everything touched is live, all else is garbage Reference Counting [Collins, 1960] Each object has count of incoming pointers Adjust count in case of mutations (write barrier) When counter reaches zero, object is garbage and count of all children is decremented A Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 8
  • 11. Duality of Tracing and Reference Counting Qualitative ComparisonDiametrical Opposites? Tracing Reference Counting Collection Style Batch Incremental Pause Times Long Short Real Time? No Yes Delayed Reclamation? Yes No Cost per Mutation None High Collects Cycles? Yes No 1 1 1[Table from paper] A Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 9
  • 12. Duality of Tracing and Reference Counting Qualitative ComparisonHow Different Really? Both types have been implemented by the authors Very different starting point But with optimizations, similarities increase: Both trace roots Both are semi-incremental Both have oating garbage Both have write barriers Why? A Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 10
  • 13. Duality of Tracing and Reference Counting Abstract Garbage CollectionAbstract Garbage Collection Roots R Denition An object graph is a triple G = (V, E, R) with V the set of vertices (objects) V E the multiset of directed edges (pointers) R the multiset of roots Multiset notation: [a, b] [b] = [a, b, b] Denition A function : V N0 is a reference count function for an object graph G = (V, E, R) iff x V : (x) = |[(u, x) E : (u) > 0]| + 1xR # in-edges from vertices with a non-zero RC (+1) A Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 11
  • 14. Duality of Tracing and Reference Counting Abstract Garbage CollectionAbstract Garbage Collection Roots R Denition An object graph is a triple G = (V, E, R) with V the set of vertices (objects) V E the multiset of directed edges (pointers) R the multiset of roots Multiset notation: [a, b] [b] = [a, b, b] Denition A function : V N0 is a reference count function for an object graph G = (V, E, R) iff x V : (x) = |[(u, x) E : (u) > 0]| + 1xR # in-edges from vertices with a non-zero RC (+1) A Unied Theory of Garbage Collection (Bacon et al.) Seminar Talk by Yoshimi Takano 11
  • 15. Duality of Tracing and Reference Counting Abstract Garbage CollectionAbstract Garbage Collection, contd Denition A garbage collection algorithm takes an object graph G as input and computes a reference count function for G. Objects x with (x) = 0 are then reclaimed. Common abstract model, where any algorithm computes

Recommended

View more >