News for hackers. Stuff that matters.
Re:There's No Such Thing as “Implicitly Atomic” by sapiogram on Thursday October 05, 2023 @01:37PM (#37781505)
Interestingly, the Go memory model[1] does in fact guarantee atomicity of word-sized reads/writes:

> Otherwise, each read of a single-word-sized or sub-word-sized memory location must observe a value actually written to that location (perhaps by a concurrent executing goroutine) and not yet overwritten.

However, it allows the implementation to immediately exit and report an error as well.

[1]: https://go.dev/ref/mem

Re:There's No Such Thing as “Implicitly Atomic” by andrewaylett on Thursday October 05, 2023 @02:15PM (#37782014)
While Rust won't let you share a non-atomic variable across threads without going through a lock of some form or using `unsafe`.

So for both Rust and Go you'll get atomic accesses when you need them, and for C etc you only get atomic accesses if you ask for them. Which pretty much speaks to the different programming models: Rust and Go will only compile the subset of possibly-valid programs that can be expressed by the language and proven by the compiler. C compilers will only reject code they can prove is incorrect.