1 / 35

Write Barrier Elision for Concurrent Garbage Collectors

Write Barrier Elision for Concurrent Garbage Collectors. Martin T. Vechev Cambridge University David F. Bacon IBM T.J.Watson Research Center. Write Barriers for Concurrent GC. Mutator and Collector interleaved Mutator changes object graph Potential race conditions

sanam
Download Presentation

Write Barrier Elision for Concurrent Garbage Collectors

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Write Barrier Elision for Concurrent Garbage Collectors Martin T. Vechev Cambridge University David F. Bacon IBM T.J.Watson Research Center

  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. Can Synchronization Be Reduced? ? • Minimum information from a mutator to a collector? • without compromising correctness? • Can static analysis help? • Can we discover dynamic opportunities? write barrier Concurrent Collector write Heap Connectivity Graph Mutators read read

  4. Outline • The Synchronization Problem • Elimination conditions • Elimination opportunities (limit study) • Elimination correlation • Exploiting Order • Conclusions and Future Work

  5. The Synchronization Problem B C P1 A Time Collector Working - Marks B as live

  6. The Synchronization Problem B B P2 C C P1 P1 A A Time Thread Working Collector Working - Marks B as live - Installs P2

  7. The Synchronization Problem B B B P2 P2 C C C P1 P1 A A A Time Thread Working Thread Working Collector Working - Marks B as live - Installs P2 - Deletes P1

  8. The Synchronization Problem B B B B P2 P2 P2 C C C ? P1 P1 A A A A Time Thread Working Thread Working Collector Working Collector Working • C was not seen • Reclaims C: live! - Marks B as live - Installs P2 - Deletes P1

  9. The Synchronization Problem A and B contain pointers to Object C Point of Error Memory Location P1 A P2 B 0 1 2 3 4 5 6 Time

  10. Types of Write Barriers Steele Marks B (Source) for rescanning Dijkstra Mark C (new target) as live Yuasa Mark C (old target) as live B B B B P2 P2 P2 C C C C P1 P1 A A A A TIME Collector Working Thread Working Thread Working Collector Working

  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. Contributions • Four Elimination Conditions a static analysis can utilize. • Main idea based on pointer lifetimes. • Two Covering conditions: Apply to all barriers • 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. Single Covering Condition B B B B P2 C C C C P1 P1 P1 P1 A A A A TIME Thread Working Thread Working Collector Working Collector Working Memory Location • Key Observation: • P1’s lifetime covers P2’s • Barriers on P2 are redundant P1 A P2 B Time 1 2 3

  14. Single Covering Condition (Incremental) Memory Location Memory Location Rescan Roots L H A A H H B B Time Time 4 4 1 2 3 1 2 3

  15. Single Covering Condition (Snapshot) Memory Location Memory Location L H A A H H B B Time Time 4 4 1 2 3 1 2 3

  16. Multiple Covering Condition Memory Location V P1 A P2 B P3 C Time 0 1 2 3 4 5 6 7 • Key Observation : • P1 together with a barrier on P2 form a virtual pointer PV • Apply Single Covering to eliminate barriers on P3

  17. Multiple Covering Condition (Incremental) Memory Location Memory Location L L A A L H B B H H C C Time Time 4 4 1 2 3 1 2 3

  18. Multiple Covering Condition (Incremental) Memory Location Memory Location H H A A L H B B H H C C Time Time 4 4 1 2 3 1 2 3

  19. Multiple Covering Condition (Snapshot) Memory Location Memory Location L L A A L H B B H H C C Time Time 4 4 1 2 3 1 2 3

  20. Multiple Covering Condition (Snapshot) Memory Location Memory Location H H A A L H B B H H C C Time Time 4 4 1 2 3 1 2 3

  21. Single Allocation Condition Memory Location Key Observation : H starts Inside ‘New’ pointer N N A P2 B Time 1 2 3 • 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

  22. Multiple Allocation Condition • Key Observation : • V = N join L • Apply SAC between V and H Memory Location V N A L B H C Time 1 2 3

  23. Eliminating Null Pointer Stores Dijkstra(destination, new_pointer) if (Collector_Marking && new_pointer != NULL) store (new_pointer); Yuasa(destination, old_pointer) if ( Collector_Marking && old_pointer != NULL) store (old_pointer); • 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

  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. Barrier Elimination Potential – Dijkstra / Steele

  26. Barrier Elimination Potential - Yuasa

  27. Time (MB) vs. Eliminated Yuasa Barriers • Elimination is Periodic => WB elimination occurs in bursts JAVAC

  28. Time (MB) vs. Eliminated Yuasa Barriers • Elimination is Periodic => WB elimination occurs in bursts DB db

  29. Object Size (words) vs. Eliminated Yuasa Barriers • Elimination is on Small objects JAVAC

  30. Object Age vs. Eliminated Yuasa Barriers • Elimination is mostly on Young objects (Log Y scale) JAVAC

  31. Object Age vs. Eliminated Yuasa Barriers • An Exception DB

  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. Single Object Scenarios (Order matters) Broken Sequence P2 P2 P2 B B B B C C C ? P1 P1 Time Thread Working Thread Working Collector Working Collector Working • B is partially • scanned (gray) • Installs P2 - Deletes P1 • Reclaims live • object C incorrectly

  34. Single Object Scenarios (Order matters) Correct Sequence B B B B C C C C P1 P1 P2 P2 P2 Collector Working Thread Working Thread Working Collector Working • B is partially • scanned (gray) - Installs P2 - Deletes P1 • C is NOT collected

  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.

More Related