Presentation is loading. Please wait.

Presentation is loading. Please wait.

MOSTLY PARALLEL GARBAGE COLLECTION Authors : Hans J. Boehm Alan J. Demers Scott Shenker XEROX PARC Presented by:REVITAL SHABTAI.

Similar presentations


Presentation on theme: "MOSTLY PARALLEL GARBAGE COLLECTION Authors : Hans J. Boehm Alan J. Demers Scott Shenker XEROX PARC Presented by:REVITAL SHABTAI."— Presentation transcript:

1 MOSTLY PARALLEL GARBAGE COLLECTION Authors : Hans J. Boehm Alan J. Demers Scott Shenker XEROX PARC Presented by:REVITAL SHABTAI

2 Introduction n A method for adapting garbage collectors designed to run sequentially with the client.

3 Overview n Problem introduction n Basic idea n Method components n Implementation choices n Empirical results n Conclusions

4 Garbage Collectors Styles n Two basic styles of garbage collection algorithms: 1.Reference-counting collector 2.Tracing collector

5 Traditional Tracing n A set of root memory objects - always accessible n Mark n Mark - performing reachability from the roots and marking the accessible objects n Sweep n Sweep - reclaiming unmarked objects

6 The Problem n A straightforward implementation prevents any client action while tracing (stop-the- world) n Sometimes the tracing is an intolerable long pause n Two approaches to reduce pause times of tracing collectors: 1.Generational collectors 2.Parallel collectors

7 The Basic Idea n Most of the tracing algorithm runs in parallel with the client n Small portion of the tracing is done during stop-the-world action n Relying on virtual memory information about pages that have been updates during a given period of time

8 The Parallel Method n Define a set of dirty bits for a set of virtual pages n Clear all virtual dirty bits n Perform a parallel tracing n Update the dirty bits to reflect client writes n Stop-the-world and trace from all marked objects that lie on dirty pages n Reclaim unreachable (unmarked) objects

9 Method - Comments n The parallel tracing phase provides an approximation to the true reachable set n The stop-the-world tracing phase provides a full complete set of the reachable objects n The duration of the final stop-the- world phase is related to the number of pages written during the parallel collection

10 Method -Comments 2 n Not all unreachable objects are reclaimed, but will be reclaimed by a subsequent collection n Copying collectors (moving objects) require a more careful treatment

11 The Mark Phase n Split the heap into blocks n In each block objects of the same size n A block size is the a physical page n Set a bit for each accessible object n Queue pages for sweeping in a separate queue for each object size

12 The Sweep Phase n Done with object allocation (not during a stop-the-world) n The allocator keeps a free lists for each object size n If an empty free list is found: n Sweep the first page in the queue n Remove the page from the queue n Restore unreachable objects from this page to the free list

13 Consequences n Worst case of mark phase duration is as in the non-parallel tracing n Worst case of allocating objects is when full pages are scanned in order to find free objects n In practice both are not noticeable

14 Partial Collector - Formal Definitions n Partial Collector n Partial Collector - a collector that reclaims only a subset of all unreachable objects T n A set T (threatened) - potentially collectible objects I n A set I (immune) - the non-collectible objects

15 Formal Statements n CI n C : Every object in I is marked and every object pointed to by a marked object is also marked n TR I n TR : Mark all objects in I and trace from them n F n F : Trace from all marked objects on dirty pages

16 Stop the mostly world parallel n Stop the world n Clear all mark bits TR n Perform TR n Restart the world n Clear all mark bits n Clear all virtual dirty bits TR n Perform TR n Stop the world F n Perform F n Restart the world Condition C holds Condition C does not hold C’I C’ : Every object in I is marked and every object pointed to by a marked object on a clean page is also marked

17 Reducing the stop-the- world Delay n M n M - Atomically clear the virtual dirty bits from the pages P, and trace from the marked objects on the dirty pages of P. M F n A Partial Generational Mostly Parallel Collection: 1.Perform M on the heap 2.Stop the world 3.Perform F 4.Restart the world

18 Reducing the stop-the-world Delay- Version 2 n M’ n 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

19 Implementation Choices M’ M n Repeated applications of M’ instead of a single application of M M n Run M more that once before a partial collection M M n Further variants of M are possible (such as M mark from other sets) n When to run a full collection? When to expand the heap? n How to control the scheduling of the client and collector threads

20 Empirical Results

21 Mostly Parallel Copying Collectors n For each object, additional space is required for forwarding links n The collector copies from from- space to to-space and update the forwarding links

22 Mostly Parallel Copying Collector Implementation n Additions to the copying collector: 1.Clear the forwarding links 2.Update dirty pages bits 3.Update forwarding links O O O n In the stop-the-world phase for any object O that lie on dirty page: 1.Copy any object O points at 2.Update pointers in copies 3.Copy O and update its fields

23 Conclusion n Mostly parallel partial generational tracing collector that run sequentially with the client n Various implementation choices for various cases n Reduced the stop-the-world phase time duration

24 THE END


Download ppt "MOSTLY PARALLEL GARBAGE COLLECTION Authors : Hans J. Boehm Alan J. Demers Scott Shenker XEROX PARC Presented by:REVITAL SHABTAI."

Similar presentations


Ads by Google