Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Fully automatic memory-managed languages should be considered first.

Of which none has solved concurrency. Some like Java prevents UB but garbage data will still be produced if you don’t diligently protect the access of the shared data.



Java doesn't produce 'garbage data', racing writes will never show intermediary results.


Loss of Sequential Consistency means realistically humans cannot understand the behaviour of the software and so "garbage" seems like a reasonable characterisation of the results. It might take a team of experts some considerable time to explain why your software did whatever it did, or you can say "that's garbage" and try to fix the problem without that understanding of the results.

The hope when Java developed this memory model was that loss of SC is something humans can cope with, it was not, the behaviour is too strange.


Even with sequential consistency, interweaving multiple threads produces results that go firmly into the garbage category. Even something as simple as adding to a variable can fail.

To solve interweaving, add mutexes. And once you have mutexes you'll be protected from weak memory models.


What is the end result of two threads adding +1 to the same counter 1 million times each in parallel?

Well, the result is safe but unknowable. I would call that garbage data.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: