230 likes | 400 Views
FT36. Future of GC. Patrick Dussud Technical Fellow Developer Division. Why I A m Excited to Work on GC. Large benefit for customer workloads Sometimes larger than code generation gains GC contract is crisp and small Simple principles
E N D
FT36 Future of GC Patrick Dussud Technical Fellow Developer Division
Why I Am Excited to Work on GC • Large benefit for customer workloads • Sometimes larger than code generation gains • GC contract is crisp and small • Simple principles • The implementation can greatly evolve without compromising compatibility • It’s still a relatively unexplored area, in terms of engineering
Contents • GC backgrounder • CLR GC history • Future Directions
GC Principles • Automatic discovery of live data • System can destroy and reclaim the rest • Two techniques • Tracing • Reference Count • In fact there are multiple variants in between
GC Factors of Merit • Speed of the allocator • GC time overhead (% in GC) • GC pause time • Working set for a given workload • Multi – Core scaling (all of preceding F.O.M)
Mechanisms and Policy • Often mechanisms are a clever way to implement a policy (see favorite GC research papers) • Better: An architecture including multiple policy-free mechanisms controlled by policy • Key to a long lived implementation
CLR GC architecture .NET FX and program CLR Rootscanning GC Policies Thread suspension Mechanisms Runtime Helpers Virtual Memory and OS or Hosting layer
CLR GC V1 • Choice of Workstation or server GC • Common architecture • Both allocators are MP scalable • Most mechanisms are shared • Policies are tuned to each scenarios • Concurrent GC to reduce pause time • MP scalable GC for servers to reduce GC overhead
CLR GC V1 Workload Assumptions • Workstation • Allocation activity is moderate • Low pause time important • Server • Uniform workload on multiple requests • Pause time tolerable
CLR V3 GC • Workstation • Low latency mode API • Server GC • Gen 2 notifications API
CLR V4 GC • Workstation • Background GC: Allows ephemeral GCs (Gen0-1) while engaged in a concurrent Gen2 GC • Alleviate the assumption that allocation activity is moderate • Net effect: Reduced pause time in full GC for all workloads
Technology Trends • More cores • More memory (Larger heaps) • Virtualization
GC Scorecard • Speed of the allocator • GC time overhead (% in GC) • Max GC pause time for large heaps • Working set for a given workload
GC Pause Time • Background GC needs more feedback but it seems very good so far • Same approach can be brought to Server GC • Real Time GC not likely for mainstream CLR because of its adverse effect on program execution speed (read barriers)
Working Set • Large Object Heap isn’t compacting • Background GC isn’t compacting • Will pause executing threads on low memory situations • Considering LOH compaction • Partial compaction for Background GC • Picking a badly fragmented (small)area • Compacting it while doing a gen0-1 GC
How About Hardware Assist? • Done in the 80s:TI Explorer and Symbolics Ivory chips • At that time transistors were at a premium, Ivory was too slow for general computing • Now transistors are cheaper • Read Barriers would give the most bang for the buck
How About OS assist? • Good research on avoiding paged out object scanning • Paging is becoming less relevant • Some mechanisms canbe improved by having more integration between the Virtual Memory manager and the segment manager of GC • Useful for virtualization • Can delay paging
More Ideas Worth Exploring • Tracing is worthwhile when survival is low • Gen2 survival is generally high • Loosely maintained Reference Count on Gen2 objects would allow for a large percentage of dead objects reclamation without tracing the whole heap. There is research literature on the subject
A Final Note • Thank you for providing so much feedback over the years! • Keep the feedback coming. This is what makes our GC great!
YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation forms online at MicrosoftPDC.com
Learn More On Channel 9 • Expand your PDC experience through Channel 9. • Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses. channel9.msdn.com/learn Built by Developers for Developers….