Posts Tagged ‘threads’

Java volatile field modifier

Friday, June 27th, 2008

Ever used Java’s “volatile” field modifier? Here’s a good explanation of what it’s good for:

What does volatile do?

The takeaway for me was that for performance reasons, each thread has a local cached copy of the variables stored “main” memory.  If you don’t use volatile, a given thread will look at its local cached copy [...]