Sunday, September 12, 2010

Volatile Variables in Java

  • A volatile write happens-before all the following reads of the same variables.
  • A volatile is similar to a unlock   or monitor exit.
  • A volatile read is similar to lock or monitor enter.
  • Used for non blocking synchronization
  • Read and write go directly  to the memory.