I was reading the following article: http://msdn.microsoft.com/en-us/magazine/cc817398.aspx \"Solving 11 Likely Problems In Your Multithreaded Code\" by Joe Duffy
An
Locking is necessary if you need it to be atomic. Reading and writing (as a paired operation, such as when you do an i++) a 32-bit number is not guaranteed to be atomic due to caching. In addition an individual read or write doesn't necessarily go right to a register (volatility). Making it volatile doesn't give you any guarantee of atomicity if you have the desire to modify the integer (e.g. a read, increment, write operation). For integers a mutex or monitor may be too heavy (depends on your use case) and that's what the Interlocked class is for. It guarantees atomicity of these types of operation.