Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.
-
Upload
edgardo-askren -
Category
Documents
-
view
222 -
download
0
Transcript of Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.
![Page 1: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/1.jpg)
Andy C. King and Richard Jones
University of Kent at Canterbury
Removing GC Synchronisation
![Page 2: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/2.jpg)
Overview
The Problem
An Observation
L & S Heaplets
Implementation
A Fly in the Ointment
Swatting the Fly
Measurements
Future Work
![Page 3: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/3.jpg)
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
![Page 4: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/4.jpg)
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
![Page 5: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/5.jpg)
T1
T2
G L1
L2
L & G Heaplets
![Page 6: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/6.jpg)
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
![Page 7: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/7.jpg)
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
![Page 8: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/8.jpg)
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
![Page 9: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/9.jpg)
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)
![Page 10: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/10.jpg)
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
![Page 11: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/11.jpg)
T1
T2
G L1
L2
OL1
OL2
Swatting the Fly (2)
![Page 12: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/12.jpg)
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)
![Page 13: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/13.jpg)
T1
T2
G L1
L2
OL1
OL2
Swatting the Fly (4)
![Page 14: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/14.jpg)
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
![Page 15: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/15.jpg)
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
![Page 16: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/16.jpg)
Finally get the bloody numbers from the GC…
Future Work
![Page 17: Andy C. King and Richard Jones University of Kent at Canterbury Removing GC Synchronisation.](https://reader035.fdocuments.us/reader035/viewer/2022062318/551bc13f550346c3588b4a92/html5/thumbnails/17.jpg)
Andy C. King and Richard Jones
University of Kent at Canterbury
Q&A