What happens when different CPU cores write to the same RAM address without synchronization?
- 阅读更多 关于 What happens when different CPU cores write to the same RAM address without synchronization?
问题 Let's assume that 2 cores are trying to write different values to the same RAM address (1 byte), at the same moment of time (plus-minus eta), and without using any interlocked instructions or memory barriers. What happens in this case and what value will be written to the main RAM? The first one wins? The last one wins? Undetermined behavior? 回答1: x86 (like every other mainstream SMP CPU architecture) has coherent data caches . It's impossible for two difference caches (e.g. L1D of 2