2 ms·
While it's true that much of the hard work of not writing data races is still in the users hands it's important to remember that Java having a memory model and
by kjeetgill 8y ago
While it's true that much of the hard work of not writing data races is still in the users hands it's important to remember that Java having a memory model and specification for locks/volatiles is a VAST improvement over the same situation in most other languages. It expressly defines what operations do and do not imply a causal relationship, guarantees things like no word tearing on volatile longs, that variables can't "logically" be optimized out of existence in the presence of out of thread writes.
It's actually pretty great in practice.