MOSTLY PARALLEL GARBAGE COLLECTION Authors : Hans J. Boehm Alan J. Demers Scott Shenker XEROX PARC...
-
date post
19-Dec-2015 -
Category
Documents
-
view
222 -
download
2
Transcript of MOSTLY PARALLEL GARBAGE COLLECTION Authors : Hans J. Boehm Alan J. Demers Scott Shenker XEROX PARC...
MOSTLY PARALLEL GARBAGE COLLECTION
Authors : Hans J. Boehm
Alan J. Demers
Scott Shenker
XEROX PARC
Presented by:REVITAL SHABTAI
Overview Problem introduction Basic idea Method components Implementation choices Empirical results Conclusions
Garbage Collectors Styles
Two basic styles of garbage collection algorithms:
1.Reference-counting collector
2.Tracing collector
Traditional Tracing A set of root memory objects -always
accessible MarkMark - performing reachability from
the roots and marking the accessible objects
SweepSweep - reclaiming unmarked objects
The Problem A straightforward implementation prevents
any client action while tracing (stop-the-world)
Sometimes the tracing is an intolerable long pause
Two approaches to reduce pause times of tracing collectors: 1.Generational collectors 2.Parallel collectors
The Basic Idea Most of the tracing algorithm runs
in parallel with the client Small portion of the tracing is done
during stop-the-world action Relying on virtual memory
information about pages that have been updates during a given period of time
The Parallel Method Define a set of dirty bits for a set of virtual
pages Clear all virtual dirty bits Perform a parallel tracing Update the dirty bits to reflect client writes Stop-the-world and trace from all marked
objects that lie on dirty pages Reclaim unreachable (unmarked) objects
Method - Comments The parallel tracing phase provides
an approximation to the true reachable set
The stop-the-world tracing phase provides a full complete set of the reachable objects
The duration of the final stop-the-world phase is related to the number of pages written during the parallel collection
Method -Comments 2
Not all unreachable objects are reclaimed, but will be reclaimed by a subsequent collection
Copying collectors (moving objects) require a more careful treatment
The Mark Phase Split the heap into blocks In each block objects of the same size A block size is the a physical page Set a bit for each accessible object Queue pages for sweeping in a separate
queue for each object size
The Sweep Phase
Done with object allocation (not during a stop-the-world)
The allocator keeps a free lists for each object size
If an empty free list is found: Sweep the first page in the queue Remove the page from the queue Restore unreachable objects from
this page to the free list
Consequences
Worst case of mark phase duration is as in the non-parallel tracing
Worst case of allocating objects is when full pages are scanned in order to find free objects
In practice both are not noticeable
Partial Collector - Formal Definitions Partial CollectorPartial Collector - a collector that reclaims
only a subset of all unreachable objects A set TT (threatened) - potentially collectible
objects A set I I (immune) - the non-collectible
objects
Formal Statements
CC : Every object in I I is marked and every object pointed to by a marked object is also marked
TRTR : Mark all objects in I I and trace from them FF : Trace from all marked objects on dirty pages
Stop the mostly world parallel Stop the world Clear all mark bits Perform TRTR Restart the world
Clear all mark bits Clear all virtual
dirty bits Perform TR TR Stop the world Perform FF Restart the world
Condition C holds Condition C
does not hold
C’C’ : Every object in I I is marked and every object pointed to by a marked object on a clean page is also marked
Reducing the stop-the-world Delay MM - Atomically clear the virtual dirty
bits from the pages P, and trace from the marked objects on the dirty pages of P.
A Partial Generational Mostly Parallel Collection:1.Perform M M on the heap 2.Stop the world 3.Perform FF 4.Restart the world
Reducing the stop-the-world Delay- Version 2 M’M’ : 1.Atomically
clear the dirty bits from the pages P 2.For all
marked objects pointed to by marked objects on dirty pages of P mark them and dirty the pages on which they reside
Implementation Choices Repeated applications of M’M’ instead of a single
application of MM Run MM more that once before a partial collection Further variants of M M are possible (such as MM
mark from other sets) When to run a full collection?
When to expand the heap? How to control the scheduling of the
client and collector threads
Empirical ResultsAve Pause Times Max Pause
Times No. of
Collections (full) Total Time In
Sec10MBalloc20meg
46323 51350 3(3) 332.2 Full 125 870 20(0) 24.4 Gen 102 350 11(0) 32.0 Gen.Par
Ave Pause Times Max Pause
Times No. of
Collections (full) Total Time In
Sec10MB Boyer
56548 63380 4(4) 512.6 Full 9291 41840 22(5) 360.6 Gen 169 329 12(2) 259.6 Gen.Par
Ave Pause Times Max Pause
Times No. of
Collections (full) Total Time In
Sec36MBalloc20meg
1037 1040 3(3) 16.4 Full 81 200 17(0) 15.5 Gen 76 100 11(0) 17.2 Gen.Par
Ave Pause Times Max Pause
Times No. of
Collections (full) Total Time In
Sec36MB Boyer
1368 1610 4(4) 51.6 Full 528 1471 22(5) 60.4 Gen 134 159 13(2) 66.1 Gen.Par
Mostly Parallel Copying Collectors For each object, additional space
is required for forwarding links The collector copies from from-
space to to-space and update the forwarding links
Mostly Parallel Copying Collector Implementation
Additions to the copying collector:1.Clear the forwarding links2.Update dirty pages bits3.Update forwarding links
In the stop-the-world phase for any object OO that lie on dirty page:
1.Copy any object OO points at2.Update pointers in copies3.Copy O O and update its fields
Conclusion
Mostly parallel partial generational tracing collector that run sequentially with the client
Various implementation choices for various cases
Reduced the stop-the-world phase time duration