- It is a user mode primitive (utilizes CPU Resource) used fr atomic updates.
- It tells the compiler not to optimize the code.
- It tells the Threads to access the value directly from main memory and do not trust the value cached elsewhere.
Methods In Volatile :
Volatile.Read and Volatile.Write .They take overloaded arguments of int,bool,short,enum.
public int m_flag=0; Volatile.Write(ref m_flag, 1);