On Tue, Sep 09, 2025 at 10:30:49PM +0200, Marc Gonzalez wrote: > On 9/9/25 21:34, Leon Woestenberg wrote: > > > Basically, you are reverse-tuning a multicore CPU system, > > that is heavily optimized for time-sharing and overall > > system throughput, back to act like bare-metal single-application. > > You can get close, but you will never reach the determinism > > of say, an Cortex-R(ealtime) Core. > > This ignores the fact that I've been testing 2 programs: > > - P1, toy code that just calls dec 3 times in a tight loop > - P2, a few memory accesses, everything fits in L1 > > I then loop P1 & P2 2^16 times to compute their average run-time. > > Over thousands of runs, RUNTIME_P1 is ALWAYS the same (within 30 ppm) > > Over thousands of runs, RUNTIME_P2 varies by up to 12 PERCENT (!!) = > 122k ppm Modern CPUs are highly complex systems with their micro architecture. The result is non-deterministic runtime behavior. I can't tell what you are measuring is the ballpark of non-deterministic runtime variance. If you don't want to read through the CPU manufactures documentation, you could check if the Spectre and related side channels attack papers give some clues on timings behavior?