4 ms·
What is different on intel since you can play fast and loose with multi threading? Two threads reading and writing the same memory area without and locking woul
by FnuGk 6y ago
What is different on intel since you can play fast and loose with multi threading?
Two threads reading and writing the same memory area without and locking would give problems regardless of the ISA or am i missing something?
- prattmic 6y agoARM has a weakly-ordered memory model, while x86 is much more strongly-ordered. See https://en.wikipedia.org/wiki/Memory_ordering#Runtime_memory_ordering https://en.wikipedia.org/wiki/Memory_ordering#Runtime_memory.... So e.g., on x86 if you store to A then store to B, then if another core sees the store to B it is guaranteed to see the store to A as well. This guarantee does not exist on ARM.
- petters 6y agoThe C++ standard is famously complicated about atomics and memory order (for a good reason): https://en.cppreference.com/w/cpp/atomic/memory_order https://en.cppreference.com/w/cpp/atomic/memory_order But on x86, many of these things don't matter, if I understand correctly.
- jfkebwjsbx 6y agoYes, you are missing something. Two threads reading and writing to the same memory area do not necessarily give problems. In fact, many software is built to exploit several facts about how memory accesses work with respect each other. ARM processors give very few guarantees, so code has to workaround that.