I'm using Ubuntu 20.04 and am working on performance optimisations of some CFD code. When timing my code for quick feedback as to whether some modification is beneficial, there's often quite large run-to-run variance, due to background processes kicking in.
Because the code is using all available threads, any one thread being burdened with background tasks causes all others to wait.
Now my question is, whether or not there is a quick and easy way to temporarily halt background/non-essential tasks and therefore put my system into a kind of benchmark mode. Bash scripts, packages, built-in options, all is welcome.