Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor
volatile
volatile

Wiki Markup
*volatile* : Declaring a variable {{volatile}} ensures that all threads see a consistent value of the variable. Volatile guarantees atomic reads and writes of values, however, it does not guarantee the atomicity of composite operations such as variable incrementation (read-modify-write sequence). "A write to a volatile field (§8.3.1.4) happens-before every subsequent read of that field" \[[JLS 05|AA. Java References#JLS 05]\]. "Operations on the master copies of volatile variables on behalf of a thread are performed by the main memory in exactly the order that the thread requested." \[[JVMSpec 99|AA. Java References#JVMSpec 99]\]. Declaring a variable {{volatile}} ensures that all threads see a consistent value of the variable. Volatile guarantees atomic reads and writes of values, however, it does not guarantee the atomicity of composite operations such as variable incrementation (read-modify-write sequence).   

Anchor
vulnerability
vulnerability

...