260 likes | 365 Views
Ulterior Reference Counting: Fast Garbage Collection without a Long Wait. Author: Stephen M Blackburn Kathryn S McKinley Presenter: Jun Tao. Outline. Introduction Background Ulterior Reference Counting Methodology Results Conclusion. Introduction.
E N D
Ulterior Reference Counting:Fast Garbage Collection without a Long Wait Author: Stephen M Blackburn Kathryn S McKinley Presenter: Jun Tao
Outline • Introduction • Background • Ulterior Reference Counting • Methodology • Results • Conclusion
Introduction • A long-standing and unachieved goal for GC (garbage collector) • Short pause times • Excellent throughput • Throughput and responsiveness of generational collector (BG-MS) and Reference counting
Introduction • A new generational collector: Ulterior Reference Counting (URC) • Copying nursery • Reference counting mature space • Use a deferred reference counting • Divides the heap into logical partitions of RC and non-RC objects • Reference count only infrequently mutated fields • Defer the fields of highly mutated objects and enumerate them • Trace the deferred pointers • Use a write barrier to remember them
Introduction • Object lifetime and mutation demographics combine well to fit that requirement • Young objects mutate frequently and die at a high rate • Favor generational collection, with copying algorithm using fast contiguous allocations for the young objects • Old objects mutate infrequently and die at a slower rate • Favor a space efficient free-list allocatorand a reference counting algorithm
Introduction • BG-RC: a hybrid generational collector • BG: bounded copying nursery • RC: Reference counts the mature space • Ignores nursery pointer mutations • For surviving nursery objects • Enumerates live pointers during tracing • Copies them to RC space • Computes reference counts for the mature space • Reclaims objects with no reference
Background • Generational Collection • Use tracing to identify dead objects indirectly • Copying collector • Copies all live objects into another space • Works well when few objects survive • Use bump-pointer allocation • Mark-sweep collector • Marks live objects • Frees all unmarked objects • Uses free-list allocation • Needs no copy reserve • Poor memory utilization without compaction
Background • Generational Collection • How to organize nursery collection • Flexible-sized nursery • Fixed-size nursery • Bounded nursery
Background • Reference Counting • Advantage • The work of garbage detection is spread out over every mutation • Disadvantage • Additional algorithms must reclaim cycles • Tracking every pointer mutation is expensive
Background • ReferenceCounting (continued) • Mechanisms • Deferral • Examines certain heavily mutated pointers periodically • Deferral phase in which RCs are not correct • RC phase in which they are • Buffering • Do not perform RC increments and decrements immediately • Buffer and process them in RC phase • Coalescing • The periodicity of deferred RC implies that only the initial values and final values of pointer fields are relevant • Uses the differences to generate increments and decrements
Background • Reference Counting (continued) • RC Formal Definitions • Mutation event RCM(p) • i.e., RC(p before)--, RC(pafter)++ • May be buffered or performed immediately • Retain event RCR(p) • Deferral • No mutation generates RCM(p) • Need a RCR(p) to preserve objects
Ulterior Reference Counting • Generalizing Deferral A RC integrate event RCI(p) changes a deferred pointer to not-deferred is needed.
Ulterior Reference Counting • Deferral policies • Determines for each pointer whether or not to perform mutation events • Three approaches to enumerates deferral set • Trace Deferred Fields • Trace all live deferred fields just prior to every RC phase • Record Mutated Deferred Fields • Record Mutated Deferred Objects
Ulterior Reference Counting • A Generational RC Hybrid Collector (BG-RC) • For young objects • Bump-pointer allocation • Copying collection • For old objects • Free-list allocation • Reference counting collection
Ulterior Reference Counting • A Generational RC Hybrid Collector (BG-RC)(continued)
Ulterior Reference Counting • A Generational RC Hybrid Collector (BG-RC)(continued) • Write Barrier • Remembers pointers into the nursery from the non-nursery spaces • An object remembering coalescing barrier
Ulterior Reference Counting • Write Barrier(continued)
Ulterior Reference Counting • Controlling Pause Times • Pause time : Nursery collection time + reference counting time • Appropriate nursery size • Large • Small • Frequent collections • Diminishes the effect of coalescing in RC • Gives nursery objects less time to die • Bound the accumulation of RC work between collections • Limit the growth of meta data • Modified object buffer • Decrement buffer
Ulterior Reference Counting • Cycle Detection • Bacon and Rajan’s trial deletion algorithm • Colors the objects from all decrements which do not go to zero purple and puts them on a list • If a purple still non-zero at the end of a RC phase,computes the object and objects reachable from it gray and decrements their RCs • All gray objects with RC=0 are cyclic garbage • The authors’ choice • Perform cycle detection with increasing probability when the available heap space falls toward a user-defined limit
Methodology • Jikes RVM and JMTk • Collectors • RC: coalescing, deferred • BG-RC • MS • BG-MS: bounded copying nursery; MS mature space
Results • Sensitivity to Heap size • Generational collectors perform better on both GC time and mutator time • Benefit from bump-pointers • As the heap size shrinks, BG-RC degrades more rapidly than BG-MS • Pause time guidelines prevent it from reclaiming cyclic garbage promptly • Mutator time • Performance: MS > BG-MS > BG-RC
Results BG-RC Sensitivity to Variations in Collection Triggers (defaults are 4MB nursery, 60ms time cap, and 512KB cycle trigger)
Conclusion • Matches allocation and collection policies to the behaviors of older and younger objects • Copying collector on nursery • Reference Counting collector on mature space • Achieves good performance on both throughput and responsiveness