July 26, 2009
[Java] The difference between volatile and synchronized
Quote from java.util.concurrenct package docs:
A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking.
Labels: critical section, java, synchronized, volatile