Download presentation
Presentation is loading. Please wait.
1
0 Parallel and Concurrent Real-time Garbage Collection Part I: Overview and Memory Allocation Subsystem David F. Bacon T.J. Watson Research Center
2
1 What It Does (Demo) http://www.youtube.com/user/ibmrealtime
3
2 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
3 Why It’s Important DDG-1000 Destroyer Telco SIP Switch Air Java (w/ Berkeley CE) JAviator (w/ Salzburg) Java-based Synthesizer Playstation/Xbox etc Automotive Electronics 33% 7% 22% Trade Execution
5
4 Who and When Metronome (2001-2004) Recycler (1999-2001) 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
5 Digression: Keys to Success Intelligence Collaboration Problem Selection
7
6 Perspectives Concurrent garbage collection is –A key language runtime component –A challenging verification problem –A multi-faceted concurrent algorithm
8
7 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
8 Where it Fits In JVM JITInterpreterGC Class Libraries RTSJ Arraylets, Barriers Class Libraries RTSJ Arraylets, Barriers AoT Compiler RTSJ Scopes, Threads Class (Un)Loader (realtime) JVMPIDebugRAS System Management Weird Refs Weak, Soft, Phantom, JNI Heap Format Dump & Parse Documentation Test 24x7 (at least) Test 24x7 (at least)
10
9 Fundamental Issues Functional correctness (duh) Liveness –Timeliness (real-time bounds) Fairness –Priorities Initiation and Termination Contention Non-determinism
11
10 Why is Concurrency Hard? Performance –Contention –Load Balancing –Overhead -> Granularity “Inherent” Simultaneity Timing and Determinism
12
11 Stack GC: A Simple Problem (?) Transitive Graph Closure r r p p T T a b X X a b U U a b Z Z a b W W a b Y Y a b Class Foo { Foo a; Foo b; }
13
12 Basic Approaches: Mark/Sweep Stack r r p p T T a b X X a b U U a b Z Z a b W W a b Y Y a b W W a b Z Z a b Y Y a b X X a b free O(live) mark phase but O(heapsize) sweep Usually requires no copying Mark stack is O(maxdepth)
14
13 Basics II: Semi-space Copying O(live) If single-threaded, no mark stack needed Wastes 50% of memory Stack r r p p T T a b X X a b U U a b Z Z a b W W a b Y Y a b W W a b Z Z a b Y Y a b X X a b
15
14 Kinds of “Concurrent” Collection “Stop the World” Parallel Concurrent Incremental APPGCAPP GCAPP GC APP GC APPGC APP GCAPP GCAPP
16
15 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 GC APPGC APPGCAPPGCAPP GCAPP
17
16 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
17 The Cycle of Life Allocate Free Mutate Not really a “garbage collector”… … but a memory management subsystem
19
18 Metronome Memory Organization Page-based Segregated free lists Ratio bounds internal & page-internal fragmentation
20
19 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
20 Page Data Structures 16 64 256 free
22
21 Page Data Synchronization, Take 1 16 64 256 free
23
22 Page Data, Take 2 16 64 256 free 16 64 256 Thread 1 16 64 256 Thread 2
24
23 http://www.research.ibm.com/metronome https://sourceforge.net/projects/tuningforkvp
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.