3 ms·
The thing about speculative execution and out of order execution to remember is that you always get the expected result from a single threaded perspective. If y
by planteen 10y ago
The thing about speculative execution and out of order execution to remember is that you always get the expected result from a single threaded perspective. If you throw in interrupts or threads, you know you must tread cautiously in C.
Few things have made me more nervous in my career than seeing a ISR making use of C++ standard library features. When I asked the engineer how they were sure this was safe and worked under the covers, I was immediately dismissed as "the compiler takes care of all that." The project only ever worked at -O0 and was still buggy. The engineer blamed the hardware.
- johncolanduoni 10y agoYou're right as far as results, but both can still mess significantly with performance even when everything is single threaded.
- vkuruthers 10y agoAhh, blaming the hardware. A sure sign they haven't looked into their code closely.
- claudius 10y ago> The thing about speculative execution and out of order execution to remember is that you always get the expected result from a single threaded perspective. Could you elaborate on this? I thought at least speculative execution was handled internally in the CPU and essentially not visible to the user apart from the performance impact? I’m not sure what you refer to as out-of-order execution, is this execution reordering within the C compiler? > If you throw in interrupts or threads, you know you must tread cautiously in C. Naturally, yes.