Upload
edgardo-askren
View
226
Download
0
Tags:
Embed Size (px)
Citation preview
Andy C. King and Richard Jones
University of Kent at Canterbury
Removing GC Synchronisation
Overview
The Problem
An Observation
L & S Heaplets
Implementation
A Fly in the Ointment
Swatting the Fly
Measurements
Future Work
Concurrency in multi-threaded applications
Synchronisation is necessary
Language level• synchronized
VM level• mutator and garbage collector (GC) threads• suspending threads before collecting
the latter can be quite costly
The Problem
Objects may be thread-local (L)
Reachable only within their allocating thread
do not need synchronisation for such objects
Can manage these objects locally
Place in per-thread heap regions called heaplets
No need to stop other threads to collect such objects
Shared objects (G) go in global heap
An Observation
T1
T2
G L1
L2
L & G Heaplets
Variation on Steensgaard [Stee00]
Escape analysis technique• automatically determine local objects• mark their allocation sites• patch to use appropriate heaplet
Flow-insensitive
Context-sensitive (specialisation)
performed at runtime
Implementation
Implementation (2)
Operates on a snapshot of the world• set of classes loaded at that point in time
JDK 1.22_06 Production Release for Solaris• new GC with heaplets• support specialisation• patches applied in interpreter• patched/specialised methods can be JIT’ed
Dynamic class loading
Class loaded after snapshot
May override method containing L allocation site
Shares the object
L allocation site now S
(transitive closure)
A Fly in the Ointment
1 class A {2 public void do(Object o) { }3 }4 class Main {5 public static void main(String[] args) {6 A a = new A();7 foo(a); SNAPSHOT ANALYSIS30 A a’ = new A’(); LOAD CLASS A’31 foo(a’);32 }33 public static void foo(A inA) {34 Object o = new Object();35 inA.do(o);36 }37 }
A Fly in the Ointment (2)
Truly shared (G)• reachable from >1 thread• G heap
Truly local (L)• reachable from exactly 1 thread• can prove type• L heaplet
Optimistically local (OL)• reachable from 1 thread• cannot prove type• OL heaplet
Swatting the Fly
T1
T2
G L1
L2
OL1
OL2
Swatting the Fly (2)
Analyse new classes immediately
Compare methods
If mismatched, OL sites are broken
Class is non-conforming
OL heaplet becomes G
can be done very cheaply
only OL heaplets of referring threads are affected
Swatting the Fly (3)
T1
T2
G L1
L2
OL1
OL2
Swatting the Fly (4)
Measurements
Classes (resolved) Methods (resolved)% %
Volano client 396 67.17 2946 94.60Volano server 514 67.70 4309 95.57SPECjbb 642 73.36 5365 96.18
Specs Bytecode +Bloat Compiled +BloatKB % KB %
Volano client 680 112 26.79 580 54.66Volano server 3193 196 82.14 657 181.58SPECjbb 2315 286 43.71 1976 68.67
Measurements (2)
L OL GVolano client 51 307 39Volano server 320 1224 474SPECjbb 281 1374 154
Started Elapsed Memorys s MB
Volano client 10 1.5 2.5Volano server 5 2.3 4.2SPECjbb 30 4.4 6.2
Finally get the bloody numbers from the GC…
Future Work
Andy C. King and Richard Jones
University of Kent at Canterbury
Q&A