Linux – How to Limit Processes to All But One CPU

cgroupscpu

I want to limit some processes to run on all but one CPU in a machine. I have looked into it and I believe that cgroups could be a viable solution. More specifically using the cpuset property.

However I have been unable to find an example that limits to more than one CPU. How is this done?

Best Answer

For simple cases, you don't cgroups, it is simpler just using the taskset command:

taskset --cpu-list 1-7 my_command args ...

The first cpu core is 0, this omits 0 from the list. To omit some other core you could do something like: --cpu-list 0,1,3,4,5,6,7

Related Question