Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Real-Time Replication Garbage Collection Scott Nettles and James O’Toole PLDI 93 Presented by: Roi Amir.

Similar presentations


Presentation on theme: "1 Real-Time Replication Garbage Collection Scott Nettles and James O’Toole PLDI 93 Presented by: Roi Amir."— Presentation transcript:

1

2 1 Real-Time Replication Garbage Collection Scott Nettles and James O’Toole PLDI 93 Presented by: Roi Amir

3 2 The Problem *GC pauses are always annoying *Pauses are not always tolerable *In real-time applications the mutator is expected to progress at a steady rate *For truly real-time applications GC can not be carried out as one atomic action while the program is halted For example: A smooth mouse tracking in an interactive graphics application requires at least a 20Hz update ratio

4 3 Incremental Garbage Collection * Small units of garbage collection must be interleaved with small units of program execution * The incremental tracing for garbage is more interesting than the incremental reclamation of detected garbage * The running program (mutator) may mutate the graph while the collector “isn't looking” * There must be a way to keep track of change during mutator execution

5 4 Copying GC: A Short Reminder Root Set From SpaceTo Space Before

6 5 Copying GC (Cont.) Root Set To Space From Space After

7 6 Tricolor Marking Abstraction * GC algorithms can be described as a process of traversing the graph of reachable objects and coloring them * All objects subject to GC are initially colored in white * Objects that were found alive are colored in black * When there are no reachable nodes left to blacken the GC is finished Gray signify that an object has been reached by the traversal, but that its descendants may not have been.

8 7 Abstraction (Cont.) * In a copying collector, Gray objects are the objects in the unscanned area of to-space * No black object holds a pointer directly to a white object A C B D Before A C B D After

9 8 The Solution *The mutator uses only the original ‘from-space’ invariant * Mutations are logged * A write-barrier is used * The GC incrementally builds a consistent replica of the accessible objects

10 9 Replication GC Outline Mutator GC Log RD WR Object from-spaceto-space Object The goal of the GC is to successfully replicate all live objects which are present in ‘from-space’ by creating corresponding objects in ‘to-space’

11 10 Logging Mutations * After the collector has replicated an object, the original object may be modified by the mutator * The mutator records all mutations in a ‘mutation log’ * The collector processes the ‘log’ entries and applies the mutations to the replicas. * Mutation logging works best when mutations are infrequent or can be recorded without mutator cooperation

12 11 Collector “from-space” Invariant The invariant maintained by the collector is that the mutator can only access ‘from-space’ objects, that all previously scanned objects in ‘to-space’ contain only ‘to- space’ pointers, and that all ‘to-space’ replicas are up to date with respect to their original ‘from-space’ objects, unless a corresponding mutation is recorded in the mutation log.

13 12 Completion Condition * Mutation log is empty * Mutator roots have been scanned * All the objects in to-space have been scanned All objects in ‘to-space’ are up to date Objects in ‘to-space’ contain only to-space pointers Swap memory spaces

14 13 Optimizations Opportunities The collector only needs to replicate all live objects soon enough to terminate and reuse the memory in ‘from-space’ before the application runs out of memory. * Freedom in copying order and location (locality,cache order…) * Copying objects later can save log processing

15 14 Implementation * Runtime system of standard ML (no stack) * Two-level generational heap design. (new/old & to/from) * Runtime parameters for controlling the collector new-space old-space Minor Major from-spaceto-space

16 15 Controlling Pause Duration *In order to control the total pause time caused by the collector the incremental algorithm restricts the amount of work it does using a runtime parameter,defined as L. * L limits the total amount of memory copied by the collector during a single pause. There is an implementation-dependent lower bound for L that will guarantee termination.

17 16 Performance Pause graph

18 17 Conclusions * Controlled pause times can be achieved * Good for soft real-time applications


Download ppt "1 Real-Time Replication Garbage Collection Scott Nettles and James O’Toole PLDI 93 Presented by: Roi Amir."

Similar presentations


Ads by Google