17 ms·
> You are, of course, right, although I'd say that it's fairly unusual for the "sequential execution of CPU instructions" abstraction to leak. On x86. x86 and
by bitwize 1y ago
> You are, of course, right, although I'd say that it's fairly unusual for the "sequential execution of CPU instructions" abstraction to leak.
On x86. x86 and x86-64 usually do a good job of enforcing memory access order as if the instructions were executed sequentially. Other architectures, not so much. On PowerPC you had to put explicit memory barriers guaranteeing a certain access order with the 'eieio' instruction. ARM processors feature similar weak memory order, but the Apple M1 and later feature a special mode that guarantees strong x86-64 memory order, to make emulation for programs written for Intel Macs easier.
- Yoric 1y agoAh, good point, I haven't programmed for anything other than x86-64 in a while. But even then, if you're using any kind of compiler, either this is successfully hidden from you... or you've hit some UB in C or C++ and you're in nasal demon territory anyway, no?