1 / 24

David F. Bacon T.J. Watson Research Center

Parallel and Concurrent Real-time Garbage Collection Part I: Overview and Memory Allocation Subsystem. David F. Bacon T.J. Watson Research Center. What It Does. (Demo). http://www.youtube.com/user/ibmrealtime. What it Is. A production garbage collector that is

zody
Download Presentation

David F. Bacon T.J. Watson Research Center

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. Parallel and ConcurrentReal-time Garbage CollectionPart I: Overview and Memory Allocation Subsystem David F. Bacon T.J. Watson Research Center

  2. What It Does (Demo) http://www.youtube.com/user/ibmrealtime

  3. What it Is • A production garbage collector that is • Real-time (450us worst-case latencies) • Multiprocesing (uses multiple CPUs) • Concurrent (can run in background) • Robust (within and across JVMs)

  4. Why It’s Important 33% 22% Playstation/Xbox etc 7% DDG-1000 Destroyer Telco SIP Switch Automotive Electronics Trade Execution JAviator (w/ Salzburg) Java-based Synthesizer Air Java (w/ Berkeley CE)

  5. Who and When Recycler (1999-2001) Metronome (2001-2004) WebSphere Realtime (2004-2007) Dick Attanasio David Bacon V.T. Rajan Steve Smith Han Lee David Bacon Perry Cheng V.T. Rajan Martin Vechev Josh Auerbach David Bacon Perry Cheng Dave Grove 5 Developers 10 Testers 5 Salespeople …

  6. Digression: Keys to Success • Intelligence • Collaboration • Problem Selection

  7. Perspectives • Concurrent garbage collection is • A key language runtime component • A challenging verification problem • A multi-faceted concurrent algorithm

  8. Goals • Learn how to bridge: • from abstract design… • …to concrete implementation • Learn how to combine different • algorithms… • …and implementations… • …into a complete system • Gain deep understanding • highly complex, real-world system • apply lessons to your problems

  9. Where it Fits In JVM Class Libraries RTSJ Arraylets, Barriers Interpreter JIT GC Documentation AoT Compiler RTSJ Scopes, Threads Class (Un)Loader (realtime) JVMPI Debug RAS Test 24x7 (at least) System Management Weird Refs Weak, Soft, Phantom, JNI Heap Format Dump & Parse

  10. Fundamental Issues • Functional correctness (duh) • Liveness • Timeliness (real-time bounds) • Fairness • Priorities • Initiation and Termination • Contention • Non-determinism

  11. Why is Concurrency Hard? • Performance • Contention • Load Balancing • Overhead -> Granularity • “Inherent” Simultaneity • Timing and Determinism

  12. U W Z Y T X a a a a a a b b b b b b GC: A Simple Problem (?) • Transitive Graph Closure Stack Class Foo { Foo a; Foo b; } p r

  13. T Y X W U Z Y X Z W a a a a a a a a a a b b b b b b b b b b Basic Approaches: Mark/Sweep free Stack • O(live) mark phase but O(heapsize) sweep • Usually requires no copying • Mark stack is O(maxdepth) p r

  14. W Z U Y T X Y X W Z a a a a a a a a a a b b b b b b b b b b Basics II: Semi-space Copying Stack • O(live) • If single-threaded, no mark stack needed • Wastes 50% of memory p r

  15. Kinds of “Concurrent” Collection APP GC APP • “Stop the World” • Parallel • Concurrent • Incremental APP APP APP APP APP GC APP APP GC APP APP GC APP APP GC APP APP APP APP GC APP GC APP GC APP APP APP APP APP APP APP APP APP

  16. Our Subject: Metronome-2 System • Parallel, Incremental, and Concurrent • No increment exceeds 450us • Real-time Scheduling • Smooth adaptation from under- to over-load • Implementation in production JVM APP GC APP GC APP GC APP GC APP APP APP APP APP GC APP

  17. What Does “Real-time” Mean? • Minimal, predictable interruption of application • Collection finishes before heap is exhausted • “Real space” - bounded, predictable memory • Honor thread priorities • Micro- or macro-level determinism (cf. CK)

  18. The Cycle of Life Allocate • Not really a “garbage collector”… • … but a memory management subsystem Free Mutate

  19. Metronome Memory Organization • Page-based • Segregated free lists • Ratio bounds internal & page-internal fragmentation

  20. Large Objects: Arraylets • (Almost) eliminates external fragmentation • (Almost) eliminates need for compaction • Very large arrays still need contiguous pages • Extra indirection for array access

  21. Page Data Structures 16 64 256 free

  22. Page Data Synchronization, Take 1 16 64 256 free

  23. Page Data, Take 2 16 64 256 Thread 1 16 64 256 Thread 2 16 64 256 free

  24. http://www.research.ibm.com/metronomehttps://sourceforge.net/projects/tuningforkvphttp://www.research.ibm.com/metronomehttps://sourceforge.net/projects/tuningforkvp

More Related