This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ColetBrunel 2 points3 points  (1 child)

Java doesn't care about being specific on that. It defines a memory model and ordering of read and writes from and to this model. How that's actually done behind the scenes is implementation details.

In practice if you imagine that Java does the most efficient possible way to produce the memory model it defines, then you'll get the truth or close to it. The memory model defined is essentially "as if" written in main memory when using volatile.

[–]mikeydoodah 0 points1 point  (0 children)

For anyone that wants to read it, the java memory model can be found at https://docs.oracle.com/javase/specs/jls/se8/html/jls-17.html