Weak vs. Strong Memory Models (2012)
preshing.com
preshing.com
What this doesn't mention is that the software memory model for systems languages like C++ should pretty much be as weak as possible, to be able to generate good code on platforms that range from strong to weak. If the software memory model is weaker that your hardware's, it just works, because the compiler will know whether hardware reordering is possible. If it's stronger, getting optimal code generation is pretty much impossible, because you're forced to take the stronger semantics, even in places where you don't need them.
My friends' practical experiences suggest it's still bugged here and there.
Edit: you gotta love how people on HN will down-vote you for sharing factual information on a topic. Are we levelling down to Reddit's standards?
A strong memory model is also trivial to implement on a weak memory system whereas the reverse is impossible. I can believe that Java on ARM can have bugs (fewer customers, relatively newer than x86, etc). It can also have bugs due to someone writing weak operations that were only tested on a strong memory model machine (ie latent bugs that wouldn’t be discovered on a weak memory model machine). Or heck. It can have bugs precisely because someone wants to somehow leverage weak operations for performance butt it did so incorrectly.
Side note: The M1 is an interesting CPU because it implements both strong and weak memory models directly in HW.
I don’t know why you got downvotes but what you provided was more of an opinion than fact (my post too is opinion).
This is exactly what my comment is implying. On x86 you have a very strong memory ordering consistency in the form of TSO. This not only helps implementing synchronisation primitives but also in practice enables techniques such as synchronisation piggybacking which isnt safe on weaker models such as ARM's.
> what you provided was more of an opinion than fact
Don't really know how to respond to that beyond if the differences between memory models are a matter of opinion rather than facts than the following wiki page shouldn't even exist
A factual post might try to back up the claim with specific bugs or more detailed analysis that has been done.
https://stackoverflow.com/questions/tagged/memory-barriers
https://stackoverflow.com/questions/tagged/memory-model
https://stackoverflow.com/questions/tagged/java-memory-model
Also, the x86 tag on SO has plenty of memory model-focused discussions although it's only TSO.
The replies to this John Regehr thread were particularly rich with links https://twitter.com/johnregehr/status/1451355617583460355?s=...