4 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. The wrongfully ass
by Yoric 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.
The wrongfully assumed "O(1) memory access" (or worse, wrongfully assumed O(1) data structure access even when the data structure actually isn't O(1)) showed up more frequently in my experience. And I still don't understand how we keep writing code that assumes "fast, reliable network" when we're reminded every day that code is neither fast nor reliable.
- 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?