Rust for atomic functions

I was interested in finding some particular processes' timings and I wanted to see wall clock time without switching processes. Is there a way to make it atomic so it doesn't get put to ready queue by the CPU? If the entire program is not swapped till execution, it wouldn't have been an issue but since all programs keep getting swapped by CPU process scheduler, is there any way to turn that off or make this atomic?

I'm not sure, but the keywords you are looking for are processor pinning and CPU affinity.

1 Like

I am not entirely good with OS knowledge, but I think the affinity doesn't override scheduling?
In my case, I want the entire program to be run fully without any interrupts on a round-robin system.

On Linux, you should be able to exclude a CPU from being scheduled as described here. You can then set specific processes to be executed on that core.

1 Like