SlideShare uma empresa Scribd logo
1 de 111
Baixar para ler offline
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Java Concurrency
A(nother) Peek Under the Hood
David Buck
Principal Member of Technical Staff
Java SE Sustaining Engineering
September, 2016
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
4
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
About Me
David Buck
• Java SE Sustaining Engineering
• Mostly JRockit fixes
• OpenJDK 8 Updates
Project Maintainer
• Hobbies: Programming
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Introduction
Background
Tangent 1: Special Relativity
History
Implementation
Tangent 2: HSDIS
Future
Conclusions
1
2
3
4
5
6
6
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Introduction
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Motivation
“But I don’t write multithreaded code…”
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Web Server
picture: Coolcaesar at the English language Wikipedia [GFDL (http://www.gnu.org/copyleft/fdl.html) or CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0/)]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
GUI
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Libraries
picture: David Vignoni / ICON KING (http://icon-king.com) [LGPL (http://www.gnu.org/licenses/lgpl.html) or LGPL (http://www.gnu.org/licenses/lgpl.html)]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Batch Processing
picture: US Social Security Administration (http://www.ssa.gov/history/acalcs.html) [Public domain]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
“But I don’t write multithreaded code…”
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
“But I don’t write multithreaded code…”
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Race Conditions
picture: Sakurambo at English Wikipedia [GFDL (http://www.gnu.org/copyleft/fdl.html) or CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0/)]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Heisenbugs
Bug Heisenberg
Heisenbug
picture: Bundesarchiv, Bild 183-R57262 / Unknown / CC-BY-SA 3.0 [CC BY-SA 3.0 de (http://creativecommons.org/licenses/by-sa/3.0/de/deed.en)]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Observer Effect
picture: Christian Schirm (Own work) [CC0]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Avoiding Heisenbugs
• Java Memory Model
• synchronized keyword
• java.util.concurrent
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Avoiding Heisenbugs
• Java Memory Model
• synchronized keyword
• java.util.concurrent
• Don’t do XXX
• You must do YYY
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
a² + b² == c²
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |picture: WTF Public License, Version 2
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Background
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Memory Model
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Memory Model
Definition 1
Specification that explains when we can guarantee that a written value may
be read correctly
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
void hogeMethod1() {
int localA = 42;
assert localA == 42;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
static int staticA;
void hogeMethod2() {
staticA = 42;
assert staticA == 42;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
int data = 0;
boolean ready = false;
void hoge3() {
while (!ready) {};
assert data == 42;
}
void hoge4() {
data = 42;
ready = true;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Culprit #1
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Culprit #2
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Memory Ordering
void hoge5() {
a = 1;
b = 2;
c = 3;
d = 4;
e = 5;
a = a + 1;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Memory Ordering
void hoge5() {
a = 1;
b = 2;
c = 3;
d = 4;
e = 5;
a = a + 1;
}
void hoge5() {
a = 2;
b = 2;
c = 3;
d = 4;
e = 5;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Memory Ordering
void hoge5() {
a = 1;
b = 2;
c = 3;
d = 4;
e = 5;
a = a + 1;
}
void hoge5() {
b = 2;
c = 3;
d = 4;
e = 5;
a = 2;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Rule
Single threaded behavior must never change
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Out of Order Execution
picture: Amit6, original version (File:Superscalarpipeline.png) by User:Poil (Own work) [CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0)]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
CPU Differences
Type Alpha ARMv7
PA-
RISC
POWER
SPARC
RMO
SPARC
PSO
SPARC
TSO
x86
x86
oostore
AMD64 IA-64 zSeries
load-
load
Y Y Y Y Y Y Y
load-
store
Y Y Y Y Y Y Y
store-
store
Y Y Y Y Y Y Y Y
store-
load
Y Y Y Y Y Y Y Y Y Y Y Y
Atomic
(loads)
Y Y Y Y Y
Atomic
(stores)
Y Y Y Y Y Y
Depend
ent
loads
Y
instruct
ion
cache
Y Y Y Y Y Y Y Y Y Y
chart source: https://en.wikipedia.org/wiki/Memory_ordering
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
CPU Differences
Loose Strict
Alpha
X86
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
CPU Differences
Loose Strict
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Memory Barriers
int data = 0;
boolean ready = false;
void hoge3() {
while (!ready) {};
assert data == 42;
}
void hoge4() {
data = 42;
ready = true;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Memory Barriers
int data = 0;
boolean ready = false;
void hoge3() {
while (!ready) {};
assert data == 42;
}
void hoge4() {
data = 42;
ready = true;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Memory Barriers
int data = 0;
boolean ready = false;
void hoge3() {
while (!ready) {};
assert data == 42;
}
void hoge4() {
data = 42;
ready = true;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Memory Barriers Types
• store-store
• store-load
• load-store
• load-load
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Compiler Barriers
• GCC
– __asm__ __volatile__("":::"memory");
• VC++
– _ReadBarrier
– _WriteBarrier
– _ReadWriteBarrier
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Tangent 1: Special Relativity
picture: Sakurambo (Own work) [Public domain]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Tangent 1: Special Relativity
A
B
C
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Tangent 1: Special Relativity
A
B
C
A, B, C
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Tangent 1: Special Relativity
A
B
C
A, B, C C, B, A
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Tangent 1: Special Relativity
Observed order depends on viewer's frame of reference
A
B
C
A, B, C C, B, A
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
No single “correct” timeline
• Special Relativity
– Observed order of events depends on frame of reference
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
No single “correct” timeline
• Special Relativity
– Observed order of events depends on frame of reference
• Multithreaded Code
– Observed order of events depends on thread
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Memory Model
Definition 2
• Clarify what multithreaded behavior developers may depend on
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Memory Model
Definition 2
• Clarify what multithreaded behavior developers may depend on
• Limits what types of optimizations the runtime may do
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
History
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Java Memory Model (JMM)
• Write once, run anywhere
• 1995
• Part of the formal language
specification
• Happened-before
picture: Peter Campbell [GFDL (http://www.gnu.org/copyleft/fdl.html) or CC BY-SA 4.0-3.0-2.5-2.0-1.0 (http://creativecommons.org/licenses/by-sa/4.0-3.0-2.5-2.0-1.0)]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
happened-before
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Leslie Lamport
• LaTex
• happened-before
picture: Leslie Lamport [GFDL (http://en.wikipedia.org/wiki/GFDL]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
happened-before
void hoge5() {
a = 1;
b = 2;
c = 3;
d = 4;
e = 5;
a = a + 1;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
happened-before
void hoge4() {
data = 42;
ready = true;
}
void hoge3() {
while (!ready) {};
assert data == 42;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
happened-before
void hoge4() {
data = 42;
ready = true;
}
void hoge3() {
while (!ready) {};
assert data == 42;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
happened-before
void synchronized hoge4()
{
data = 42;
ready = true;
}
void synchronized hoge3()
{
while (!ready) {};
assert data == 42;
}
Warning: if hoge3 is executed first, the above code will deadlock
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
happened-before
void synchronized hoge4()
{
data = 42;
ready = true;
}
void synchronized hoge3()
{
while (!ready) {};
assert data == 42;
}
Warning: if hoge3 is executed first, the above code will deadlock
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
JMM Specification
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Original JMM Keywords
• synchronized
– mutual exclusion
– happened-before
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Original JMM Keywords
• synchronized
– mutual exclusion
– happened-before
• volatile
– Visibility
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Problems with the Original JMM
• volatile does not establish a happened-before relationship
• final values can change
• Many important runtime optimization were not allowed
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Doug Lea
• Author of the Java Multithreaded
bible
• Introduced his own OSS high-level
multithreaded library
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Java SE 5.0
• Modern JMM introduced
• Lea’s library added to official JDK
picture: Zvi Roger [CC BY 3.0 (http://creativecommons.org/licenses/by/3.0)]
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Modern JMM
• JSR-133
• Fixed shortcomings in original JMM
– volatile does establish happens-before
– final values will never change
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Modern JMM Keywords
• synchronized
– mutual exclusion
– happened-before
• volatile
– visibility
– happened-before
• final
– immutability
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
JSR-133 の volatile
void hoge4() {
data = 42;
ready = true;
}
void hoge3() {
while (!ready)
{};
assert data ==
42;
}
Warning: if hoge3 is executed first, the above code will deadlock
volatile boolean ready = false;
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
volatile != atomic
volatile int id = 0;
int incID() {
return id++;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
volatile != atomic
volatile int id = 0;
int incID() {
return id++;
}
reg = [id]
reg++
[id] = reg
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
volatile != atomic
volatile int id = 0;
synchronized int incID() {
return id++;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
happened-before
• Monitor (acquisition / release)
• Volatile (read / write)
• final “freeze” (constructor)
• JNI
– System.out.println()
– Input / Output
• thread start()/join()
• operations on j.u.concurrent collections
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
java.util.concurency
• JSR-166
• Doug Lee’s OSS multithreading library
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Multithreaded Control
• java.util.concurency
• synchronized
– wait()/notify()
• volatile / final
Abstract
Low-level
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Fork/Join (JDK 7)
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Functional Programming (JDK 8)
• Lambda Forms
• Stream API
λ
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Implementation
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Tangent 2: HSDIS (HotSpot Disassembler)
• Lets us see code generated by JIT
• Requires a disassembler plugin
– GNU binutils-based plugin
– base-hsdis
• Command line options
– +PrintAssembly
– +CompileCommand=print,*MyClass.myMethod
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Demos
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
ARM Assembly Crash Course
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
ARM Assembly Crash Course
Op Target Source
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
ARM Assembly Crash Course
MOV r02 #42
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
ARM Assembly Crash Course
MOV r02 #42
r02 = 42
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
ARM Assembly Crash Course
Op Target Source
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
ARM Assembly Crash Course
Op Target Source
Exception
STR Source Target
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
ARM Assembly Crash Course
MOV
Copies registers
MOV r02 r03
Writes Literals
MOV r02 #42
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
ARM Assembly Crash Course
LDx
Loads data from memory to a register
ldr r03, [r06]
r03 = *r06
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
ARM Assembly Crash Course
CMP / BEQ
Compare and branch if equal
cmp r0, #0
beq 0x74178d08
if (r0 == 0) goto 0x74178d08
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
ARM Assembly Crash Course
DMB
Data Memory Barrier
dmb st
dmb sy
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
One more thing…
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Safe Points
• Methods proactively poll
• JVM makes page unreadable to stop world
movw ip, #45056 ; 0xb000
movt ip, #30461 ; 0x76fd
ldr ip, [ip] ; {poll_return}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Long Value
static long val = 0;
public static void main(String[] args) {
new Thread(() -> { while(true) val = -1L; } ).start();
new Thread(() -> { while(true) val = 0L; } ).start();
while (true) {
long temp = val;
if ( temp != -1 && temp != 0 ) {
System.out.println("temp (DEC): " + temp);
System.out.println("temp (BIN): " + Long.toBinaryString(temp));
System.exit(-1);
}
}
}
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Object Initialization
public class ObjInit {
static ObjInit globalRef = new ObjInit();
long number;
public ObjInit() {
number = 42;
}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Object Initialization
public static void main(String[] args) {
new Thread(()
-> { while(true) {
long temp = globalRef.number;
if (temp != 42) {
System.out.println(temp);
System.exit(-1);
}
}
} ).start();
new Thread(()
-> { while(true) globalRef = new ObjInit(); } ).start(); }}
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
public class Loop extends Thread {
static boolean done = false;
public static void main(String[] args) {
Thread childThread = new Loop();
childThread.start();
System.out.println("Starting loop");
spinWait();
System.out.println("Exited loop");
}
private static void spinWait() {
while (!done) ;
}
public void run() {
try {
Thread.sleep(5 * 1000);
} catch (Exception e) {}
done = true;
}
} // class Loop
Loop
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Future
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
JEP-188/JMM9
• Not planned for JDK 9 (JMM9 != JDK 9)
• JVM-level specification
• Compatibility with C11/C++11
• Cover new features added since JDK 5
– (e.g. AtomicX.weakCompareAndSet())
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Conclusions
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Avoid low-level API
• java.util.concurency
• synchronized
– wait()/notify()
• volatile / final
Abstract
Low-level
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Code against the specification
• Intermittent bugs are common
• Behavior changes with JRE / platform
• Stuff to avoid
– synchronized (new Object()) { }
– Randomly adding volatile declarations until it magically starts working
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Testing
• As close to production environment as possible
– Same hardware
– Same JRE (including version)
– Same settings
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Java Concurrency in Practice
• Java Concurrency Bible
• Covers JSR-133 / JSR-166
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Summary
• Avoid low-level APIs
• Code against the standard, not the implementation
• Testing is always indispensible
• Must read Java Concurrency in Practice (JCiP)
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Thank You!!!
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
• [ JSR 133 (Java Memory Model) FAQ ]
https://www.cs.umd.edu/~pugh/java/memoryMo
del/jsr-133-faq.html
• [ Java Concurrency in Practice ]
http://jcip.net/
• [ Concurrent Programming in Java ]
http://gee.cs.oswego.edu/dl/cpj/
• [ The JSR-133 Cookbook for Compiler Writers ]
http://gee.cs.oswego.edu/dl/jmm/cookbook.html
• [ PrintAssembly ]
https://wiki.openjdk.java.net/display/HotSpot/Pri
ntAssembly
• [ BASIC DISASSEMBLER PLUGIN FOR HOTSPOT
DOWNLOADS ]
https://kenai.com/projects/base-
hsdis/downloads
References
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The preceding is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
108
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 109
Java Concurrency, A(nother) Peek Under the Hood [JavaOne 2016 CON1497]
Java Concurrency, A(nother) Peek Under the Hood [JavaOne 2016 CON1497]

Mais conteúdo relacionado

Semelhante a Java Concurrency, A(nother) Peek Under the Hood [JavaOne 2016 CON1497]

Bytecode Verification, the Hero That Java Needs [JavaOne 2016 CON1500]
Bytecode Verification, the Hero That Java Needs [JavaOne 2016 CON1500]Bytecode Verification, the Hero That Java Needs [JavaOne 2016 CON1500]
Bytecode Verification, the Hero That Java Needs [JavaOne 2016 CON1500]David Buck
 
Java Debuggers: A Peek Under the Hood [JavaOne 2016 CON1503]
Java Debuggers: A Peek Under the Hood [JavaOne 2016 CON1503]Java Debuggers: A Peek Under the Hood [JavaOne 2016 CON1503]
Java Debuggers: A Peek Under the Hood [JavaOne 2016 CON1503]David Buck
 
Jfokus 2017 Oracle Dev Cloud and Containers
Jfokus 2017 Oracle Dev Cloud and ContainersJfokus 2017 Oracle Dev Cloud and Containers
Jfokus 2017 Oracle Dev Cloud and ContainersMika Rinne
 
Java is Container Ready - Vaibhav - Container Conference 2018
Java is Container Ready - Vaibhav - Container Conference 2018Java is Container Ready - Vaibhav - Container Conference 2018
Java is Container Ready - Vaibhav - Container Conference 2018CodeOps Technologies LLP
 
GraalVM: Run Programs Faster Everywhere
GraalVM: Run Programs Faster EverywhereGraalVM: Run Programs Faster Everywhere
GraalVM: Run Programs Faster EverywhereJ On The Beach
 
Japanese Introduction to Oracle JET
Japanese Introduction to Oracle JETJapanese Introduction to Oracle JET
Japanese Introduction to Oracle JETGeertjan Wielenga
 
SkiPHP -- Database Basics for PHP
SkiPHP -- Database Basics for PHP SkiPHP -- Database Basics for PHP
SkiPHP -- Database Basics for PHP Dave Stokes
 
Preparing your code for Java 9
Preparing your code for Java 9Preparing your code for Java 9
Preparing your code for Java 9Deepu Xavier
 
Developers vs DBA's - APACOUC webinar 2017
Developers vs DBA's - APACOUC webinar 2017Developers vs DBA's - APACOUC webinar 2017
Developers vs DBA's - APACOUC webinar 2017Connor McDonald
 
Oracle Cloud Café hybrid Cloud 19 mai 2016
Oracle Cloud Café hybrid Cloud 19 mai 2016Oracle Cloud Café hybrid Cloud 19 mai 2016
Oracle Cloud Café hybrid Cloud 19 mai 2016Sorathaya Sirimanotham
 
Oracle Management Cloud - HybridCloud Café - May 2016
Oracle Management Cloud - HybridCloud Café - May 2016Oracle Management Cloud - HybridCloud Café - May 2016
Oracle Management Cloud - HybridCloud Café - May 2016Bastien Leblanc
 
The Oracle Autonomous Database
The Oracle Autonomous DatabaseThe Oracle Autonomous Database
The Oracle Autonomous DatabaseConnor McDonald
 
10 Building Blocks for Enterprise JavaScript
10 Building Blocks for Enterprise JavaScript10 Building Blocks for Enterprise JavaScript
10 Building Blocks for Enterprise JavaScriptGeertjan Wielenga
 
General Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajevGeneral Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajevOracle Developers
 
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...Thomas Wuerthinger
 

Semelhante a Java Concurrency, A(nother) Peek Under the Hood [JavaOne 2016 CON1497] (20)

Bytecode Verification, the Hero That Java Needs [JavaOne 2016 CON1500]
Bytecode Verification, the Hero That Java Needs [JavaOne 2016 CON1500]Bytecode Verification, the Hero That Java Needs [JavaOne 2016 CON1500]
Bytecode Verification, the Hero That Java Needs [JavaOne 2016 CON1500]
 
Java Debuggers: A Peek Under the Hood [JavaOne 2016 CON1503]
Java Debuggers: A Peek Under the Hood [JavaOne 2016 CON1503]Java Debuggers: A Peek Under the Hood [JavaOne 2016 CON1503]
Java Debuggers: A Peek Under the Hood [JavaOne 2016 CON1503]
 
Jfokus 2017 Oracle Dev Cloud and Containers
Jfokus 2017 Oracle Dev Cloud and ContainersJfokus 2017 Oracle Dev Cloud and Containers
Jfokus 2017 Oracle Dev Cloud and Containers
 
Hotspot & AOT
Hotspot & AOTHotspot & AOT
Hotspot & AOT
 
Java Cloud and Container Ready
Java Cloud and Container ReadyJava Cloud and Container Ready
Java Cloud and Container Ready
 
Java is Container Ready - Vaibhav - Container Conference 2018
Java is Container Ready - Vaibhav - Container Conference 2018Java is Container Ready - Vaibhav - Container Conference 2018
Java is Container Ready - Vaibhav - Container Conference 2018
 
GraalVM: Run Programs Faster Everywhere
GraalVM: Run Programs Faster EverywhereGraalVM: Run Programs Faster Everywhere
GraalVM: Run Programs Faster Everywhere
 
Japanese Introduction to Oracle JET
Japanese Introduction to Oracle JETJapanese Introduction to Oracle JET
Japanese Introduction to Oracle JET
 
SkiPHP -- Database Basics for PHP
SkiPHP -- Database Basics for PHP SkiPHP -- Database Basics for PHP
SkiPHP -- Database Basics for PHP
 
Preparing your code for Java 9
Preparing your code for Java 9Preparing your code for Java 9
Preparing your code for Java 9
 
Developers vs DBA's - APACOUC webinar 2017
Developers vs DBA's - APACOUC webinar 2017Developers vs DBA's - APACOUC webinar 2017
Developers vs DBA's - APACOUC webinar 2017
 
Oracle Cloud Café hybrid Cloud 19 mai 2016
Oracle Cloud Café hybrid Cloud 19 mai 2016Oracle Cloud Café hybrid Cloud 19 mai 2016
Oracle Cloud Café hybrid Cloud 19 mai 2016
 
Oracle Management Cloud - HybridCloud Café - May 2016
Oracle Management Cloud - HybridCloud Café - May 2016Oracle Management Cloud - HybridCloud Café - May 2016
Oracle Management Cloud - HybridCloud Café - May 2016
 
The Oracle Autonomous Database
The Oracle Autonomous DatabaseThe Oracle Autonomous Database
The Oracle Autonomous Database
 
10 Building Blocks for Enterprise JavaScript
10 Building Blocks for Enterprise JavaScript10 Building Blocks for Enterprise JavaScript
10 Building Blocks for Enterprise JavaScript
 
General Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajevGeneral Capabilities of GraalVM by Oleg Selajev @shelajev
General Capabilities of GraalVM by Oleg Selajev @shelajev
 
Imworld.ro
Imworld.roImworld.ro
Imworld.ro
 
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
 
Slovenian Oracle User Group
Slovenian Oracle User GroupSlovenian Oracle User Group
Slovenian Oracle User Group
 
Session at Oredev 2016.
Session at Oredev 2016.Session at Oredev 2016.
Session at Oredev 2016.
 

Mais de David Buck

JDK 13 New Features [MeetUp with Java Experts! @Gaienmae/Dojima 2019]
JDK 13 New Features [MeetUp with Java Experts! @Gaienmae/Dojima 2019]JDK 13 New Features [MeetUp with Java Experts! @Gaienmae/Dojima 2019]
JDK 13 New Features [MeetUp with Java Experts! @Gaienmae/Dojima 2019]David Buck
 
JDK Mission Control: Where We Are, Where We Are Going [Groundbreakers APAC 20...
JDK Mission Control: Where We Are, Where We Are Going [Groundbreakers APAC 20...JDK Mission Control: Where We Are, Where We Are Going [Groundbreakers APAC 20...
JDK Mission Control: Where We Are, Where We Are Going [Groundbreakers APAC 20...David Buck
 
Java Bytecode Crash Course [Code One 2019]
Java Bytecode Crash Course [Code One 2019]Java Bytecode Crash Course [Code One 2019]
Java Bytecode Crash Course [Code One 2019]David Buck
 
CSI (Crash Scene Investigation) HotSpot: Common JVM Crash Causes and Solution...
CSI (Crash Scene Investigation) HotSpot: Common JVM Crash Causes and Solution...CSI (Crash Scene Investigation) HotSpot: Common JVM Crash Causes and Solution...
CSI (Crash Scene Investigation) HotSpot: Common JVM Crash Causes and Solution...David Buck
 
invokedynamic for Mere Mortals [Code One 2019]
invokedynamic for Mere Mortals [Code One 2019]invokedynamic for Mere Mortals [Code One 2019]
invokedynamic for Mere Mortals [Code One 2019]David Buck
 
Hangs, Slowdowns, Starvation—Oh My! A Deep Dive into the Life of a Java Threa...
Hangs, Slowdowns, Starvation—Oh My! A Deep Dive into the Life of a Java Threa...Hangs, Slowdowns, Starvation—Oh My! A Deep Dive into the Life of a Java Threa...
Hangs, Slowdowns, Starvation—Oh My! A Deep Dive into the Life of a Java Threa...David Buck
 
JDK Mission Control: Where We Are, Where We Are Going [Code One 2019]
JDK Mission Control: Where We Are, Where We Are Going [Code One 2019]JDK Mission Control: Where We Are, Where We Are Going [Code One 2019]
JDK Mission Control: Where We Are, Where We Are Going [Code One 2019]David Buck
 
Java Concurrency, A(nother) Peek Under the Hood [Code One 2019]
Java Concurrency, A(nother) Peek Under the Hood [Code One 2019]Java Concurrency, A(nother) Peek Under the Hood [Code One 2019]
Java Concurrency, A(nother) Peek Under the Hood [Code One 2019]David Buck
 
Z Garbage Collector
Z Garbage CollectorZ Garbage Collector
Z Garbage CollectorDavid Buck
 
Valhalla Update JJUG CCC Spring 2019
Valhalla Update JJUG CCC Spring 2019Valhalla Update JJUG CCC Spring 2019
Valhalla Update JJUG CCC Spring 2019David Buck
 
Var handles jjug_ccc_spring_2018
Var handles jjug_ccc_spring_2018Var handles jjug_ccc_spring_2018
Var handles jjug_ccc_spring_2018David Buck
 
JDK 10 へようこそ
JDK 10 へようこそJDK 10 へようこそ
JDK 10 へようこそDavid Buck
 
Java SE 8におけるHotSpotの進化 [Java Day Tokyo 2014 C-2]
Java SE 8におけるHotSpotの進化 [Java Day Tokyo 2014 C-2]Java SE 8におけるHotSpotの進化 [Java Day Tokyo 2014 C-2]
Java SE 8におけるHotSpotの進化 [Java Day Tokyo 2014 C-2]David Buck
 
HotSpot のロック: A Peek Under the Hood [JJUG ナイトセミナ JVM 特集 2015年8月]
HotSpot のロック: A Peek Under the Hood [JJUG ナイトセミナ  JVM 特集  2015年8月]HotSpot のロック: A Peek Under the Hood [JJUG ナイトセミナ  JVM 特集  2015年8月]
HotSpot のロック: A Peek Under the Hood [JJUG ナイトセミナ JVM 特集 2015年8月]David Buck
 
Lambda: A Peek Under The Hood [Java Day Tokyo 2015 6-3]
Lambda: A Peek Under The Hood [Java Day Tokyo 2015 6-3]Lambda: A Peek Under The Hood [Java Day Tokyo 2015 6-3]
Lambda: A Peek Under The Hood [Java Day Tokyo 2015 6-3]David Buck
 
Java Concurrency, A(nother) Peek Under the Hood [Java Day Tokyo 2016 3-C]
Java Concurrency, A(nother) Peek Under the Hood [Java Day Tokyo 2016 3-C]Java Concurrency, A(nother) Peek Under the Hood [Java Day Tokyo 2016 3-C]
Java Concurrency, A(nother) Peek Under the Hood [Java Day Tokyo 2016 3-C]David Buck
 
Ahead-of-Time Compilation with JDK 9 [Java Day Tokyo 2017 D1-A1]
Ahead-of-Time Compilation with JDK 9 [Java Day Tokyo 2017 D1-A1]Ahead-of-Time Compilation with JDK 9 [Java Day Tokyo 2017 D1-A1]
Ahead-of-Time Compilation with JDK 9 [Java Day Tokyo 2017 D1-A1]David Buck
 
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]David Buck
 
HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]
HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]
HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]David Buck
 
Let’s Write Our Own Chip-8 Interpreter! [JavaOne 2017 CON3584]
Let’s Write Our Own Chip-8 Interpreter! [JavaOne 2017 CON3584] Let’s Write Our Own Chip-8 Interpreter! [JavaOne 2017 CON3584]
Let’s Write Our Own Chip-8 Interpreter! [JavaOne 2017 CON3584] David Buck
 

Mais de David Buck (20)

JDK 13 New Features [MeetUp with Java Experts! @Gaienmae/Dojima 2019]
JDK 13 New Features [MeetUp with Java Experts! @Gaienmae/Dojima 2019]JDK 13 New Features [MeetUp with Java Experts! @Gaienmae/Dojima 2019]
JDK 13 New Features [MeetUp with Java Experts! @Gaienmae/Dojima 2019]
 
JDK Mission Control: Where We Are, Where We Are Going [Groundbreakers APAC 20...
JDK Mission Control: Where We Are, Where We Are Going [Groundbreakers APAC 20...JDK Mission Control: Where We Are, Where We Are Going [Groundbreakers APAC 20...
JDK Mission Control: Where We Are, Where We Are Going [Groundbreakers APAC 20...
 
Java Bytecode Crash Course [Code One 2019]
Java Bytecode Crash Course [Code One 2019]Java Bytecode Crash Course [Code One 2019]
Java Bytecode Crash Course [Code One 2019]
 
CSI (Crash Scene Investigation) HotSpot: Common JVM Crash Causes and Solution...
CSI (Crash Scene Investigation) HotSpot: Common JVM Crash Causes and Solution...CSI (Crash Scene Investigation) HotSpot: Common JVM Crash Causes and Solution...
CSI (Crash Scene Investigation) HotSpot: Common JVM Crash Causes and Solution...
 
invokedynamic for Mere Mortals [Code One 2019]
invokedynamic for Mere Mortals [Code One 2019]invokedynamic for Mere Mortals [Code One 2019]
invokedynamic for Mere Mortals [Code One 2019]
 
Hangs, Slowdowns, Starvation—Oh My! A Deep Dive into the Life of a Java Threa...
Hangs, Slowdowns, Starvation—Oh My! A Deep Dive into the Life of a Java Threa...Hangs, Slowdowns, Starvation—Oh My! A Deep Dive into the Life of a Java Threa...
Hangs, Slowdowns, Starvation—Oh My! A Deep Dive into the Life of a Java Threa...
 
JDK Mission Control: Where We Are, Where We Are Going [Code One 2019]
JDK Mission Control: Where We Are, Where We Are Going [Code One 2019]JDK Mission Control: Where We Are, Where We Are Going [Code One 2019]
JDK Mission Control: Where We Are, Where We Are Going [Code One 2019]
 
Java Concurrency, A(nother) Peek Under the Hood [Code One 2019]
Java Concurrency, A(nother) Peek Under the Hood [Code One 2019]Java Concurrency, A(nother) Peek Under the Hood [Code One 2019]
Java Concurrency, A(nother) Peek Under the Hood [Code One 2019]
 
Z Garbage Collector
Z Garbage CollectorZ Garbage Collector
Z Garbage Collector
 
Valhalla Update JJUG CCC Spring 2019
Valhalla Update JJUG CCC Spring 2019Valhalla Update JJUG CCC Spring 2019
Valhalla Update JJUG CCC Spring 2019
 
Var handles jjug_ccc_spring_2018
Var handles jjug_ccc_spring_2018Var handles jjug_ccc_spring_2018
Var handles jjug_ccc_spring_2018
 
JDK 10 へようこそ
JDK 10 へようこそJDK 10 へようこそ
JDK 10 へようこそ
 
Java SE 8におけるHotSpotの進化 [Java Day Tokyo 2014 C-2]
Java SE 8におけるHotSpotの進化 [Java Day Tokyo 2014 C-2]Java SE 8におけるHotSpotの進化 [Java Day Tokyo 2014 C-2]
Java SE 8におけるHotSpotの進化 [Java Day Tokyo 2014 C-2]
 
HotSpot のロック: A Peek Under the Hood [JJUG ナイトセミナ JVM 特集 2015年8月]
HotSpot のロック: A Peek Under the Hood [JJUG ナイトセミナ  JVM 特集  2015年8月]HotSpot のロック: A Peek Under the Hood [JJUG ナイトセミナ  JVM 特集  2015年8月]
HotSpot のロック: A Peek Under the Hood [JJUG ナイトセミナ JVM 特集 2015年8月]
 
Lambda: A Peek Under The Hood [Java Day Tokyo 2015 6-3]
Lambda: A Peek Under The Hood [Java Day Tokyo 2015 6-3]Lambda: A Peek Under The Hood [Java Day Tokyo 2015 6-3]
Lambda: A Peek Under The Hood [Java Day Tokyo 2015 6-3]
 
Java Concurrency, A(nother) Peek Under the Hood [Java Day Tokyo 2016 3-C]
Java Concurrency, A(nother) Peek Under the Hood [Java Day Tokyo 2016 3-C]Java Concurrency, A(nother) Peek Under the Hood [Java Day Tokyo 2016 3-C]
Java Concurrency, A(nother) Peek Under the Hood [Java Day Tokyo 2016 3-C]
 
Ahead-of-Time Compilation with JDK 9 [Java Day Tokyo 2017 D1-A1]
Ahead-of-Time Compilation with JDK 9 [Java Day Tokyo 2017 D1-A1]Ahead-of-Time Compilation with JDK 9 [Java Day Tokyo 2017 D1-A1]
Ahead-of-Time Compilation with JDK 9 [Java Day Tokyo 2017 D1-A1]
 
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]
InvokeDynamic for Mere Mortals [JavaOne 2015 CON7682]
 
HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]
HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]
HotSpot Synchronization, A Peek Under the Hood [JavaOne 2015 CON7570]
 
Let’s Write Our Own Chip-8 Interpreter! [JavaOne 2017 CON3584]
Let’s Write Our Own Chip-8 Interpreter! [JavaOne 2017 CON3584] Let’s Write Our Own Chip-8 Interpreter! [JavaOne 2017 CON3584]
Let’s Write Our Own Chip-8 Interpreter! [JavaOne 2017 CON3584]
 

Último

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 

Último (20)

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 

Java Concurrency, A(nother) Peek Under the Hood [JavaOne 2016 CON1497]

  • 1.
  • 2.
  • 3. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Java Concurrency A(nother) Peek Under the Hood David Buck Principal Member of Technical Staff Java SE Sustaining Engineering September, 2016
  • 4. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 4
  • 5. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | About Me David Buck • Java SE Sustaining Engineering • Mostly JRockit fixes • OpenJDK 8 Updates Project Maintainer • Hobbies: Programming
  • 6. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Program Agenda Introduction Background Tangent 1: Special Relativity History Implementation Tangent 2: HSDIS Future Conclusions 1 2 3 4 5 6 6
  • 7. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Introduction
  • 8. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Motivation “But I don’t write multithreaded code…”
  • 9. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Web Server picture: Coolcaesar at the English language Wikipedia [GFDL (http://www.gnu.org/copyleft/fdl.html) or CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0/)]
  • 10. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | GUI
  • 11. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Libraries picture: David Vignoni / ICON KING (http://icon-king.com) [LGPL (http://www.gnu.org/licenses/lgpl.html) or LGPL (http://www.gnu.org/licenses/lgpl.html)]
  • 12. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Batch Processing picture: US Social Security Administration (http://www.ssa.gov/history/acalcs.html) [Public domain]
  • 13. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | “But I don’t write multithreaded code…”
  • 14. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | “But I don’t write multithreaded code…”
  • 15. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Race Conditions picture: Sakurambo at English Wikipedia [GFDL (http://www.gnu.org/copyleft/fdl.html) or CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0/)]
  • 16. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Heisenbugs Bug Heisenberg Heisenbug picture: Bundesarchiv, Bild 183-R57262 / Unknown / CC-BY-SA 3.0 [CC BY-SA 3.0 de (http://creativecommons.org/licenses/by-sa/3.0/de/deed.en)]
  • 17. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Observer Effect picture: Christian Schirm (Own work) [CC0]
  • 18. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Avoiding Heisenbugs • Java Memory Model • synchronized keyword • java.util.concurrent
  • 19. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Avoiding Heisenbugs • Java Memory Model • synchronized keyword • java.util.concurrent • Don’t do XXX • You must do YYY
  • 20. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | a² + b² == c²
  • 21. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |picture: WTF Public License, Version 2
  • 22. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Background
  • 23. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Memory Model
  • 24. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Memory Model Definition 1 Specification that explains when we can guarantee that a written value may be read correctly
  • 25. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | void hogeMethod1() { int localA = 42; assert localA == 42; }
  • 26. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | static int staticA; void hogeMethod2() { staticA = 42; assert staticA == 42; }
  • 27. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | int data = 0; boolean ready = false; void hoge3() { while (!ready) {}; assert data == 42; } void hoge4() { data = 42; ready = true; }
  • 28. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Culprit #1
  • 29. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Culprit #2
  • 30. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Memory Ordering void hoge5() { a = 1; b = 2; c = 3; d = 4; e = 5; a = a + 1; }
  • 31. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Memory Ordering void hoge5() { a = 1; b = 2; c = 3; d = 4; e = 5; a = a + 1; } void hoge5() { a = 2; b = 2; c = 3; d = 4; e = 5; }
  • 32. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Memory Ordering void hoge5() { a = 1; b = 2; c = 3; d = 4; e = 5; a = a + 1; } void hoge5() { b = 2; c = 3; d = 4; e = 5; a = 2; }
  • 33. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Rule Single threaded behavior must never change
  • 34. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Out of Order Execution picture: Amit6, original version (File:Superscalarpipeline.png) by User:Poil (Own work) [CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0)]
  • 35. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | CPU Differences Type Alpha ARMv7 PA- RISC POWER SPARC RMO SPARC PSO SPARC TSO x86 x86 oostore AMD64 IA-64 zSeries load- load Y Y Y Y Y Y Y load- store Y Y Y Y Y Y Y store- store Y Y Y Y Y Y Y Y store- load Y Y Y Y Y Y Y Y Y Y Y Y Atomic (loads) Y Y Y Y Y Atomic (stores) Y Y Y Y Y Y Depend ent loads Y instruct ion cache Y Y Y Y Y Y Y Y Y Y chart source: https://en.wikipedia.org/wiki/Memory_ordering
  • 36. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | CPU Differences Loose Strict Alpha X86
  • 37. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | CPU Differences Loose Strict
  • 38. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Memory Barriers int data = 0; boolean ready = false; void hoge3() { while (!ready) {}; assert data == 42; } void hoge4() { data = 42; ready = true; }
  • 39. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Memory Barriers int data = 0; boolean ready = false; void hoge3() { while (!ready) {}; assert data == 42; } void hoge4() { data = 42; ready = true; }
  • 40. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Memory Barriers int data = 0; boolean ready = false; void hoge3() { while (!ready) {}; assert data == 42; } void hoge4() { data = 42; ready = true; }
  • 41. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Memory Barriers Types • store-store • store-load • load-store • load-load
  • 42. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Compiler Barriers • GCC – __asm__ __volatile__("":::"memory"); • VC++ – _ReadBarrier – _WriteBarrier – _ReadWriteBarrier
  • 43. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
  • 44. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Tangent 1: Special Relativity picture: Sakurambo (Own work) [Public domain]
  • 45. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Tangent 1: Special Relativity A B C
  • 46. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Tangent 1: Special Relativity A B C A, B, C
  • 47. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Tangent 1: Special Relativity A B C A, B, C C, B, A
  • 48. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Tangent 1: Special Relativity Observed order depends on viewer's frame of reference A B C A, B, C C, B, A
  • 49. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | No single “correct” timeline • Special Relativity – Observed order of events depends on frame of reference
  • 50. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | No single “correct” timeline • Special Relativity – Observed order of events depends on frame of reference • Multithreaded Code – Observed order of events depends on thread
  • 51. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Memory Model Definition 2 • Clarify what multithreaded behavior developers may depend on
  • 52. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Memory Model Definition 2 • Clarify what multithreaded behavior developers may depend on • Limits what types of optimizations the runtime may do
  • 53. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | History
  • 54. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Java Memory Model (JMM) • Write once, run anywhere • 1995 • Part of the formal language specification • Happened-before picture: Peter Campbell [GFDL (http://www.gnu.org/copyleft/fdl.html) or CC BY-SA 4.0-3.0-2.5-2.0-1.0 (http://creativecommons.org/licenses/by-sa/4.0-3.0-2.5-2.0-1.0)]
  • 55. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | happened-before
  • 56. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Leslie Lamport • LaTex • happened-before picture: Leslie Lamport [GFDL (http://en.wikipedia.org/wiki/GFDL]
  • 57. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | happened-before void hoge5() { a = 1; b = 2; c = 3; d = 4; e = 5; a = a + 1; }
  • 58. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | happened-before void hoge4() { data = 42; ready = true; } void hoge3() { while (!ready) {}; assert data == 42; }
  • 59. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | happened-before void hoge4() { data = 42; ready = true; } void hoge3() { while (!ready) {}; assert data == 42; }
  • 60. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | happened-before void synchronized hoge4() { data = 42; ready = true; } void synchronized hoge3() { while (!ready) {}; assert data == 42; } Warning: if hoge3 is executed first, the above code will deadlock
  • 61. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | happened-before void synchronized hoge4() { data = 42; ready = true; } void synchronized hoge3() { while (!ready) {}; assert data == 42; } Warning: if hoge3 is executed first, the above code will deadlock
  • 62. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | JMM Specification
  • 63. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Original JMM Keywords • synchronized – mutual exclusion – happened-before
  • 64. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Original JMM Keywords • synchronized – mutual exclusion – happened-before • volatile – Visibility
  • 65. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Problems with the Original JMM • volatile does not establish a happened-before relationship • final values can change • Many important runtime optimization were not allowed
  • 66. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Doug Lea • Author of the Java Multithreaded bible • Introduced his own OSS high-level multithreaded library
  • 67. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Java SE 5.0 • Modern JMM introduced • Lea’s library added to official JDK picture: Zvi Roger [CC BY 3.0 (http://creativecommons.org/licenses/by/3.0)]
  • 68. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Modern JMM • JSR-133 • Fixed shortcomings in original JMM – volatile does establish happens-before – final values will never change
  • 69. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Modern JMM Keywords • synchronized – mutual exclusion – happened-before • volatile – visibility – happened-before • final – immutability
  • 70. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | JSR-133 の volatile void hoge4() { data = 42; ready = true; } void hoge3() { while (!ready) {}; assert data == 42; } Warning: if hoge3 is executed first, the above code will deadlock volatile boolean ready = false;
  • 71. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | volatile != atomic volatile int id = 0; int incID() { return id++; }
  • 72. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | volatile != atomic volatile int id = 0; int incID() { return id++; } reg = [id] reg++ [id] = reg
  • 73. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | volatile != atomic volatile int id = 0; synchronized int incID() { return id++; }
  • 74. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | happened-before • Monitor (acquisition / release) • Volatile (read / write) • final “freeze” (constructor) • JNI – System.out.println() – Input / Output • thread start()/join() • operations on j.u.concurrent collections
  • 75. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | java.util.concurency • JSR-166 • Doug Lee’s OSS multithreading library
  • 76. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Multithreaded Control • java.util.concurency • synchronized – wait()/notify() • volatile / final Abstract Low-level
  • 77. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Fork/Join (JDK 7)
  • 78. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Functional Programming (JDK 8) • Lambda Forms • Stream API λ
  • 79. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Implementation
  • 80. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Tangent 2: HSDIS (HotSpot Disassembler) • Lets us see code generated by JIT • Requires a disassembler plugin – GNU binutils-based plugin – base-hsdis • Command line options – +PrintAssembly – +CompileCommand=print,*MyClass.myMethod
  • 81. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Demos
  • 82. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | ARM Assembly Crash Course
  • 83. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | ARM Assembly Crash Course Op Target Source
  • 84. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | ARM Assembly Crash Course MOV r02 #42
  • 85. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | ARM Assembly Crash Course MOV r02 #42 r02 = 42
  • 86. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | ARM Assembly Crash Course Op Target Source
  • 87. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | ARM Assembly Crash Course Op Target Source Exception STR Source Target
  • 88. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | ARM Assembly Crash Course MOV Copies registers MOV r02 r03 Writes Literals MOV r02 #42
  • 89. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | ARM Assembly Crash Course LDx Loads data from memory to a register ldr r03, [r06] r03 = *r06
  • 90. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | ARM Assembly Crash Course CMP / BEQ Compare and branch if equal cmp r0, #0 beq 0x74178d08 if (r0 == 0) goto 0x74178d08
  • 91. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | ARM Assembly Crash Course DMB Data Memory Barrier dmb st dmb sy
  • 92. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | One more thing…
  • 93. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Safe Points • Methods proactively poll • JVM makes page unreadable to stop world movw ip, #45056 ; 0xb000 movt ip, #30461 ; 0x76fd ldr ip, [ip] ; {poll_return}
  • 94. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Long Value static long val = 0; public static void main(String[] args) { new Thread(() -> { while(true) val = -1L; } ).start(); new Thread(() -> { while(true) val = 0L; } ).start(); while (true) { long temp = val; if ( temp != -1 && temp != 0 ) { System.out.println("temp (DEC): " + temp); System.out.println("temp (BIN): " + Long.toBinaryString(temp)); System.exit(-1); } } } }
  • 95. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Object Initialization public class ObjInit { static ObjInit globalRef = new ObjInit(); long number; public ObjInit() { number = 42; }
  • 96. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Object Initialization public static void main(String[] args) { new Thread(() -> { while(true) { long temp = globalRef.number; if (temp != 42) { System.out.println(temp); System.exit(-1); } } } ).start(); new Thread(() -> { while(true) globalRef = new ObjInit(); } ).start(); }}
  • 97. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | public class Loop extends Thread { static boolean done = false; public static void main(String[] args) { Thread childThread = new Loop(); childThread.start(); System.out.println("Starting loop"); spinWait(); System.out.println("Exited loop"); } private static void spinWait() { while (!done) ; } public void run() { try { Thread.sleep(5 * 1000); } catch (Exception e) {} done = true; } } // class Loop Loop
  • 98. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Future
  • 99. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | JEP-188/JMM9 • Not planned for JDK 9 (JMM9 != JDK 9) • JVM-level specification • Compatibility with C11/C++11 • Cover new features added since JDK 5 – (e.g. AtomicX.weakCompareAndSet())
  • 100. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Conclusions
  • 101. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Avoid low-level API • java.util.concurency • synchronized – wait()/notify() • volatile / final Abstract Low-level
  • 102. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Code against the specification • Intermittent bugs are common • Behavior changes with JRE / platform • Stuff to avoid – synchronized (new Object()) { } – Randomly adding volatile declarations until it magically starts working
  • 103. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Testing • As close to production environment as possible – Same hardware – Same JRE (including version) – Same settings
  • 104. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Java Concurrency in Practice • Java Concurrency Bible • Covers JSR-133 / JSR-166
  • 105. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Summary • Avoid low-level APIs • Code against the standard, not the implementation • Testing is always indispensible • Must read Java Concurrency in Practice (JCiP)
  • 106. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Thank You!!!
  • 107. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | • [ JSR 133 (Java Memory Model) FAQ ] https://www.cs.umd.edu/~pugh/java/memoryMo del/jsr-133-faq.html • [ Java Concurrency in Practice ] http://jcip.net/ • [ Concurrent Programming in Java ] http://gee.cs.oswego.edu/dl/cpj/ • [ The JSR-133 Cookbook for Compiler Writers ] http://gee.cs.oswego.edu/dl/jmm/cookbook.html • [ PrintAssembly ] https://wiki.openjdk.java.net/display/HotSpot/Pri ntAssembly • [ BASIC DISASSEMBLER PLUGIN FOR HOTSPOT DOWNLOADS ] https://kenai.com/projects/base- hsdis/downloads References
  • 108. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 108
  • 109. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 109