Java Volatile

Опубликовано: 15 Март 2025
на канале: Jakob Jenkov
49,634
1.6k

The Java volatile keyword can be applied to Java variable declarations to force the Java VM to always read the variable value directly from main memory, and always write changes to the variable directly back to main memory immediately.

Chapters
0:00 Java volatile introduction
0:41 Non-volatile variable visibility problems
2:27 Java volatile visibility guarantee
5:30 Instruction reordering could break the Java volatile visibility guarantee
12:33 Java volatile happens before guarantee
15:03 Java volatile performance overhead
15:56 Java volatile is not always enough

Java Memory Model - JSR 133
https://www.cs.umd.edu/~pugh/java/mem...

Java volatile tutorial - textual:
http://tutorials.jenkov.com/java-conc...

Java synchronized tutorial - textual / video:
http://tutorials.jenkov.com/java-conc...
   • Java Synchronized - The synchronized ...  

Java concurrency tutorial - textual:
http://tutorials.jenkov.com/java-conc...

Java concurrency tutorial - playlist:
   • Java Concurrency and Multithreading