posted 13 years ago
When using multiple processors, the value of a variable may be altered but not visible to other cores that may require the same variable.
Marking a variable as volatile allows the compiler and runtime to prevent optimisations and improve the variable visibility so that errors are not introduced at runtime caused by this.
Note that the restrictions caused by the volatile keyword can reduce the performance of the application when utilising this variable so some care should be taken.