Systems Engineering

WritingMedium

Understanding volatile in Java, and Why It's Not a Replacement for Synchronization

By Sachin Gupta4 min read
Portrait of Sachin Gupta rendered in binary

What Java's volatile keyword actually guarantees (visibility of writes across threads) and what it does not (atomicity and mutual exclusion), and why compound operations still need synchronization.

Notes

A self-hosted write-up of this entry is on the way. In the meantime, the source link below has the canonical version, and the About page has context on the work I do day-to-day.

Related