4 ms·
>> where the exact result depends on when intermediate results are written to RAM and when they are kept in the FP stack, which might depend on intransparent th
by w0utert 7y ago
>> where the exact result depends on when intermediate results are written to RAM and when they are kept in the FP stack, which might depend on intransparent things like compiler optimisations.
One thing I've never really been sure about is how context-switching affects this. I've always assumed this could also be a source of non-deterministic floating-point results: when the OS decides to switch threads, it has to save the CPU & FPU state, and restore it when switching back. Since context switches are (practically speaking) non-deterministic on a pre-emptive OS, this would imply truncating 80-bit to 64-bit floating point values could also happen on non-deterministic points in time.
Does anyone know if this is actually true? Or do the full 80-bits get saved/restored on context switches?
- Tuna-Fish 7y agoThey are saved. The FPU state is saved using the F(N)SAVE x86 instruction, which stores 108 bytes to memory, which contains all visible FPU state.