Prev Next

Java / volatile

How compiler and runtime treats a volatile variable?

Volatile variable means it is shared so the operations on it should not be reordered with other memory operations.

These variables are not to be cached in registers or in other caches so that a read on volatile Caroline always fetch the most recent write by any thread.

More Related questions...

Show more question and Answers...


Comments & Discussions