How to run program or process on specific CPU cores on Linux
http://xmodulo.com/2013/10/run-program-process-specific-cpu-cores-linux.html
tasksetによる制御。
util-linuxパッケージに含まれる。
$ taskset --help Usage: taskset [options] [mask | cpu-list] [pid|cmd [args...]] Options: -a, --all-tasks operate on all the tasks (threads) for a given pid -p, --pid operate on existing given pid -c, --cpu-list display and specify cpus in list format -h, --help display this help -V, --version output version information The default behavior is to run a new command: taskset 03 sshd -b 1024 You can retrieve the mask of an existing task: taskset -p 700 Or set it: taskset -p 03 700 List format uses a comma-separated list instead of a mask: taskset -pc 0,3,7-11 700 Ranges in list format can take a stride argument: e.g. 0-31:2 is equivalent to mask 0x55555555 For more information see taskset(1).
$ ps 5285 ? Ss 0:00 /usr/sbin/dropbear -d /etc/dropbear/dropbear_dss_host $ taskset -p 5285 pid 5285's current affinity mask: ff $ taskset -cp 5285 pid 5285's current affinity list: 0-7
コアの指定方法。
In this example, the returned affinity (represented in a hexadecimal bitmask) corresponds to “11111111″ in binary format, which means the process can run on any of eight different CPU cores (from 0 to 7).
$ taskset -p
$ taskset -p 0×11 9030
$ taskset -cp
$ taskset -cp 0,4 9030
$ taskset
$ taskset 0×1 vlc
CPUを完全にフリーにしておきたい場合は、kernel起動パラメータで、"isolcpus=