Download presentation
Presentation is loading. Please wait.
Published byAnnabelle Kirkman Modified over 9 years ago
1
1 Write Barrier Elision for Concurrent Garbage Collectors Martin T. Vechev Cambridge University David F. Bacon IBM T.J.Watson Research Center
2
2 Write Barriers for Concurrent GC Mutator and Collector interleaved Mutator changes object graph Potential race conditions Write barriers a form of synchronization –Between mutators and the collector.
3
3 Can Synchronization Be Reduced? Minimum information from a mutator to a collector? –without compromising correctness? Can static analysis help? Can we discover dynamic opportunities? Concurrent Collector ? Mutators Heap Connectivity Graph write read write barrier
4
4 Outline The Synchronization Problem Elimination conditions Elimination opportunities (limit study) Elimination correlation Exploiting Order Conclusions and Future Work
5
5 A C B P1 The Synchronization Problem Time Collector Working - Marks B as live
6
6 A C B P1 The Synchronization Problem A C B P1 P2 Time Collector Working Thread Working - Installs P2- Marks B as live
7
7 A C B P1 The Synchronization Problem A C B P1 P2 A C B Time Collector Working Thread Working - Installs P2- Deletes P1- Marks B as live
8
8 A C B P1 ? The Synchronization Problem A C B P1 P2 A C B A B Time Collector Working Thread Working Collector Working - Installs P2- Deletes P1- Marks B as live - C was not seen - Reclaims C: live!
9
9 Time Memory Location A B P1 P2 1234560 A and B contain pointers to Object C Point of Error The Synchronization Problem
10
10 Types of Write Barriers A C B P1 A C B P2 A B A B TIME Collector Working Thread Working Collector Working C C Steele Marks B (Source) for rescanning Dijkstra Mark C (new target) as live Yuasa Mark C (old target) as live
11
11 Costs of Concurrent Write Barriers Mutator Overhead –Direct Run-time Overhead (5-20%) –I-cache pollution by write barrier code Collector Overhead –Process Write Barrier Information Space costs –Sequential Store Buffer –Increased Code Size Termination Issues –Yuasa vs. Dijkstra/Steele
12
12 Contributions Four Elimination Conditions a static analysis can utilize. –Main idea based on pointer lifetimes. 1.Two Covering conditions: Apply to all barriers 2.Two Allocation conditions: Apply to incremental barriers. Limit study shows potential for barrier elimination –For Yuasa, on average 83% can be eliminated –For Dijkstra and Steele, on average 54% can be eliminated Correlation study between barrier elimination and –Object Size –Object Lifetime –Program Locality
13
13 Single Covering Condition Time Memory Location 123 A B P1 P2 Key Observation: P1’s lifetime covers P2’s Barriers on P2 are redundant A C B P1 A C B P2 A C B A B TIME Collector Working Thread Working Collector Working P1 C
14
14 Single Covering Condition (Incremental) Time Memory Location 123 A B L H Rescan Roots 4 Time Memory Location 123 A B H H 4
15
15 Single Covering Condition (Snapshot) Time Memory Location 123 A B L H 4 Time Memory Location 123 A B H H 4
16
16 Time Memory Location A B P1 P3 12340 Multiple Covering Condition P2 567 C V Key Observation : P1 together with a barrier on P2 form a virtual pointer PV Apply Single Covering to eliminate barriers on P3
17
17 Multiple Covering Condition (Incremental) Time Memory Location 123 A B L H 4 L C Time Memory Location 123 A B L H 4 H C
18
18 Multiple Covering Condition (Incremental) Time Memory Location 123 A B H H 4 L C Time Memory Location 123 A B H H 4 H C
19
19 Multiple Covering Condition (Snapshot) Time Memory Location 123 A B L H 4 L C Time Memory Location 123 A B L H 4 H C
20
20 Multiple Covering Condition (Snapshot) Time Memory Location 123 A B H H 4 L C Time Memory Location 123 A B H H 4 H C
21
21 Single Allocation Condition Allocation conditions exploit Initial Root Set Marking Main idea: At the time of a barrier, the object is already marked Only if allocating non-white (also trade off), for Dijkstra/Steele only Time Memory Location 123 A B N P2 Key Observation : H starts Inside ‘New’ pointer N
22
22 Multiple Allocation Condition Key Observation : V = N join L Apply SAC between V and H Time Memory Location 123 A B C N L H V
23
23 Eliminating Null Pointer Stores If old pointer is NULL, eliminate barrier Yuasa vs Steele/Dijskstra Yuasa good because of initialization Null stores are easier to eliminate –But less payoff Yuasa(destination, old_pointer) if ( Collector_Marking && old_pointer != NULL) store (old_pointer); Dijkstra(destination, new_pointer) if (Collector_Marking && new_pointer != NULL) store (new_pointer);
24
24 Evaluation Methodology Limit study based on elimination condition Shows potential for elimination Traces – Jikes RVM 2.2.0 – Trace Events : Allocation, Pointer Stores – Application Objects Only Which benchmarks: –SpecJVM98 (-s100) –Jolden –Ipsixql –Xalan –Deltablue
25
25 Barrier Elimination Potential – Dijkstra / Steele
26
26 Barrier Elimination Potential - Yuasa
27
27 Time (MB) vs. Eliminated Yuasa Barriers Elimination is Periodic => WB elimination occurs in bursts JAVAC
28
28 Time (MB) vs. Eliminated Yuasa Barriers Elimination is Periodic => WB elimination occurs in bursts db DB
29
29 Object Size (words) vs. Eliminated Yuasa Barriers Elimination is on Small objects JAVAC
30
30 Object Age vs. Eliminated Yuasa Barriers Elimination is mostly on Young objects (Log Y scale) JAVAC
31
31 Object Age vs. Eliminated Yuasa Barriers An Exception DB
32
32 Further Write Barrier Elimination So far assumed collector sees pointers in any order Often, Collector order exists –take advantage of it Main idea: writes on the collector wave are safe. –Cannot apply previous conditions –Can eliminate more barriers Order extends to Lists, Queues, Trees (Needs connectivity approximation)
33
33 Single Object Scenarios (Order matters) C P1 ? Time Collector Working Thread Working Collector Working -Installs P2- Deletes P1-B is partially scanned (gray) - Reclaims live object C incorrectly C P1 P2 C Broken Sequence B BBB
34
34 Single Object Scenarios (Order matters) C P1 C P2 C C Correct Sequence Collector Working Thread Working Collector Working - Installs P2- Deletes P1- B is partially scanned (gray) - C is NOT collected BBBB P2
35
35 Conclusions and Future Work Static Analysis Elimination Conditions An Upper Bound Hot Barrier Methods Yuasa Barriers seem superior to Dijkstra/Steele –(study higher elimination vs. reduced floating garbage) –Yuasa are harder to statically eliminate More conditions possible –Requires formal reasoning Other elimination combinations possible: –Coverage (ownership) and Order can be exploited further.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.