News for hackers. Stuff that matters.
Re:Java is not a safe language by kaba0 on Monday June 13, 2022 @05:27PM (#31731989)
> Java allows data races

Regarding Java’s data races, they are “safe” as well for 32bit primitives and references (and in practice for 64bit primitives as well, but that is not spec-mandated). They offer no-out-of-thin-air protections, meaning that you can only observe values that were explicitly set by a thread. A prototypical example would be a non thread-safe counter being simultaneously incremented from many threads - in java it is guaranteed to have a value between 0 and the true count.

There are no comments on this comment yet.