Incremental Mature Garbage Collection Using the Train Algorithm
-
Upload
stacy-vasquez -
Category
Documents
-
view
21 -
download
3
description
Transcript of Incremental Mature Garbage Collection Using the Train Algorithm
![Page 1: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/1.jpg)
By
Jacob Seligmann Steffen GrarupPresented By
Leon Gendler ([email protected])
Incremental Mature Garbage Incremental Mature Garbage Collection Using the Train Collection Using the Train
AlgorithmAlgorithm
![Page 2: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/2.jpg)
Incremental Mature Garbage Incremental Mature Garbage CollectionCollection
By
Jacob Seligmann Steffen Grarup
Incremental Collection of Mature Incremental Collection of Mature ObjectsObjects
By
Richard L. Hudson J. Eliot B. Moss
![Page 3: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/3.jpg)
ContentsContents
Definitions and Traditional techniques Train Algorithm - Basic Ideas Example Technical and Implementation issues Measurement results
![Page 4: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/4.jpg)
DefinitionsDefinitionsGarbage - Space occupied by data objects which
can not be accessed.
Root Set - Global variables, local variables in the stack and registers used by active procedures.
Live Objects - The set of objects on any directed path of pointers from any member of the “root set”.
![Page 5: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/5.jpg)
Garbage Collection TechniquesGarbage Collection Techniques
Traditional Techniques: Reference Counting
Mark (Sweep, Compact)
Copy
![Page 6: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/6.jpg)
ProblemsProblems
Undetected Cycles (Ref. Count)
Fragmentation (M-S) Cost proportional to heap size (M-S) Locality of references (M-C) Extensive Paging
![Page 7: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/7.jpg)
Garbage Collection TechniquesGarbage Collection Techniques
IncrementalSmall units of G.C. between small units of
program execution.– Real-Time (Non-Disruptive).– Synchronizing the mutator with the collector
Generational“Most objects live a very short time, while a
small percentage of them live much longer”
![Page 8: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/8.jpg)
Train Algorithm - DefinitionTrain Algorithm - Definition
IncrementalIncremental garbage collection scheme for
achieving non-disruptivenon-disruptive reclamation of the
oldest generationaloldest generational area.
![Page 9: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/9.jpg)
Train Algorithm - MethodTrain Algorithm - Method
Dividing mature object spacemature object space into a number of fixed-sized blocks and collecting collecting one block at each invocationone block at each invocation.
![Page 10: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/10.jpg)
Key ContributionKey Contribution
Recognizing and reclaiming All GarbageAll Garbage while only processing a single block at a time.
Non-Disruptive collection– Upper bound on the pause time. (fixed number
of objects in one block)
![Page 11: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/11.jpg)
Train MetaphorTrain Metaphor
Memory Block Car
Set of Blocks Train
![Page 12: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/12.jpg)
Train Metaphor Train Metaphor (cont.)(cont.)
The trains are ordered by giving them sequence numbers as they are created.
Order : One block precedes another if it belongs to a lower (older) train or has a lower car numbering in the same train.
![Page 13: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/13.jpg)
![Page 14: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/14.jpg)
IntuitionIntuition
Constantly clustering sets of related objects
Eventually, any linked garbage structure collapses into the same train, no matter how complex.
![Page 15: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/15.jpg)
The VisionThe Vision
![Page 16: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/16.jpg)
Car Collection StrategyCar Collection Strategy
Process the lowest numbered car:
1.Check references into the car’s trainif non exist, reclaim the whole train
2.Move objects referenced from outside M.O.AM.O.A. (Mature Object Area) to another (older) train.
![Page 17: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/17.jpg)
Car Collection Strategy Car Collection Strategy (cont.)(cont.)
3.Move objects to the train that references them.
4.Scan the evacuated objects for pointers to the car being collected and repeat step 3.
![Page 18: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/18.jpg)
Car Collection Strategy Car Collection Strategy (cont.)(cont.)
5.Objects referenced form further cars in the same train are moved to the last car.
6.Evacuate the car.
None of the objects remaining in the car are referenced form outside.
![Page 19: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/19.jpg)
ExampleExample
![Page 20: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/20.jpg)
![Page 21: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/21.jpg)
![Page 22: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/22.jpg)
![Page 23: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/23.jpg)
![Page 24: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/24.jpg)
![Page 25: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/25.jpg)
![Page 26: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/26.jpg)
CorrectnessCorrectness
“Garbage Trains” - The set of trains holding a garbage structure.
As each “Garbage Train” is processed, either garbage reclaimed or moved to a higher train.
When the highest “Garbage Train” is reached, the garbage structure will be entirely in the train.
![Page 27: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/27.jpg)
Fixing an ErrorFixing an Error
RequirementRequirement: All trains are eventually processed.
![Page 28: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/28.jpg)
Technical IssuesTechnical Issues
Remembered set of references from outside the car pointing into the car.
Optimize by recording references only from higher numbered cars to lower numbered car.
![Page 29: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/29.jpg)
Technical Issues Technical Issues (cont.)(cont.)
““Write Barrier” - Write Barrier” - Pointer assignment run-time check.
Record pointer assignment from older to younger generations and between mature objects to other mature objects.
Train Table
![Page 30: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/30.jpg)
Popular objectsPopular objects
Large remembered set. Moving is expensive.
Sol. 1: Indirect addressing– Run-time overhead.
Sol. 2: Do not collect car, move to the end of the newest train.– Leaves garbage in or referenced from those cars.– Scatters garbage across several trains.
![Page 31: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/31.jpg)
The ImplementationThe Implementation
The Original Mjolner BETA system:The Original Mjolner BETA system: Two generations:
– I.O.A.I.O.A. reclaimed using Copy collector– M.O.A.M.O.A. reclaimed using Mark-Sweep– Arrays of pointer-less objects kept separately.
Single Remembered Set (Hash Table) for references from old to young objects
Write Barrier
![Page 32: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/32.jpg)
New BETA SystemNew BETA System
Reclamation using the Train Algorithm. 64Kb car size. A Train Table. Remembered set for each car:
– References to young generation– References from higher cars
![Page 33: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/33.jpg)
Evacuation StrategyEvacuation Strategy
Objects referenced from several trains– Last car of the first encountered train– Last car of newest train (if referenced from
outside M.O.A.M.O.A.) Promoted objects
– Last car of the newest train– Create new train if “fill limit” exceeded
![Page 34: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/34.jpg)
Invocation FrequencyInvocation Frequency
Incremental– must be called often enough so that storage
resources are never exhausted. Garbage Ratio
– Memory size before and after a collection– Adjust collection frequency accordingly
![Page 35: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/35.jpg)
Invocation Frequency Invocation Frequency (cont.)(cont.)
Difficult to calculate– parts of memory are not yet processed– only small area collected at each invocation
An object counter for each train.
![Page 36: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/36.jpg)
The ResultsThe Results
Collection pauses
Time Overhead– Young Generation Collector– Old Generation Collector
Storage Overhead
![Page 37: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/37.jpg)
Collection PausesCollection Pauses
![Page 38: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/38.jpg)
Time OverheadTime Overhead
Old Generation Collection– An increase of 20% in collection time.
Young Generation Collection– Roots are found in several remembered sets.– Object Promotion caused many set insertions
Overall Results:Overall Results:Total execution time increased by 1%.Total execution time increased by 1%.
![Page 39: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/39.jpg)
Storage OverheadStorage Overhead
Car remembered set Overhead– 6-8K per car– editor: 350 entries, compiler: 700 entries
Car size - 64K Train Table - 256K (64K entries)
– One word for the train number – One for the car number
![Page 40: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/40.jpg)
Storage Overhead Storage Overhead (cont.)(cont.)
Overall Result:Overall Result:
Old generation storage overhead of 10% - 20%
Application storage overhead of 4% - 8%
![Page 41: Incremental Mature Garbage Collection Using the Train Algorithm](https://reader036.fdocuments.us/reader036/viewer/2022070401/568135ff550346895d9d731e/html5/thumbnails/41.jpg)
ConclusionsConclusions
Non Disruptive M.O.A. collection Minimizes collection delays to few msc. A very low maximum delay A negligible increase in run time A small increase in storage requirements