Java volatile and cache

Content:

Original link: The Truth About Java’s Volatile Keyword: Beyond the Memory Myth / Medium / Mukilan Karthikeyan.

It is really just saying that volatile does not require the JVM to skip all cache only to skip non-shared cache and that shared cache can be used.

But the explanation is detailed.

And it also mentions the @Contended annotation to keep field in different cache lines. Which is advanced, but also a bit malplaced - if location in cache line matters, then Java is not the right language for the task.

Comments: