0

Is there a way to limit usage of physical CPU for linux-like OS? I do not want to limit CPU number in general I just want to bound all system processes to one CPU and run other soft on others.

tshepang
  • 12,111
  • 21
  • 91
  • 136
jurka
  • 12,945
  • 3
  • 22
  • 20

1 Answers1

3

The builtin utility taskset can be used for this given that your box has a motherboard with multiple CPU bays. The oneliner of its man states - "taskset - retrieve or set a process's CPU affinity".

tyakiomv
  • 31
  • 1
  • In addition, the usage of that CPU for a given process can be tweaked with [_cpulimit_](http://cpulimit.sourceforge.net/) – tyakiomv Sep 17 '13 at 13:40
  • So you suggest on system boot bound all running process to one CPU. And than run all other stuff on different ones. – jurka Sep 18 '13 at 06:41
  • Hi again. The _taskset_ utility can be used for setting socket and core affinity in-flight, i.e. after a process has been started. So, it is not necessary to do it prior to user-mode. It can be implemented at any point of the bootup process or after user-mode has kicked in. Unfortunately, _taskset_ needs to be run for each process you want executed only on a certain subset of CPU sockets. Please refer to [this link](http://users.sdsc.edu/~glockwood/comp/affinity.php) for a good overview of thread assignments to sockets and cores. Hope that clarifies it a bit more. – tyakiomv Sep 18 '13 at 10:10