I wrote a C program aimed at loading data with multithreading from a file. There is no pseudo-random code in my program and it always reads the same file and load the same amount of data.
When I run the program several times, I get this behaviour :
% time ./test_parallel
./test_parallel 5,04s user 1,03s system 82% cpu 7,345 total
% time ./test_parallel
./test_parallel 4,93s user 1,00s system 211% cpu 2,804 total
% time ./test_parallel
./test_parallel 4,99s user 0,92s system 245% cpu 2,411 total
% time ./test_parallel
./test_parallel 4,94s user 0,87s system 301% cpu 1,928 total
% time ./test_parallel
./test_parallel 4,93s user 0,73s system 370% cpu 1,526 total
Why isn’t my program using the approximate same amount of CPU at each execution ? How to get a more predictable and good behaviour ?
I am under Mac M1.
user25020188 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.