cpu affinity, allowing only process to run on a specific cpu

I want to bind a process to a specific core #0 (cpu affinity) via

taskset -c 0 ./run_prog

while the program it self is running on core #0, operating system may decide to run other background and active process to core #0. In other word, that command strictly limits run_prog to core #0 but doesn’t prevent other process to run on core #0 and that is bad!

Is there any way to write a bash script to first prevent active processes running on core #0 and then run that taskset command?

Source: linux

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.