Java Multithreading, Concurrency, and Parallelism — Part 12
Volatiles
So far we have seen synchronization using locking with synchronized
keyword which is a strong primitive for writing concurrent programs with less code in Java. Here in this part, we will see a weaker yet effective form of synchronization construct that Java provides — The volatile
variables.
NOTE: Please read it till the End, if you want to understand volatiles in depth. Also please be careful with the similar terms synchronized and synchronization as they are here with different meanings.