将进程绑定在CPU上运行

taskset --cpu-list 0,1,2,3 <app>

以上代码会将你的进程<app>绑定在4个CPU上运行,分别是0,1,2,3。

其他参数包括

SYNOPSIS
       taskset [options] [mask | list ] [pid | command [arg]...]
OPTIONS
       -p, --pid
              operate on an existing PID and not launch a new task
       -c, --cpu-list
              specifiy  a  numerical  list of processors instead of a bitmask.
              The list may contain multiple items,  separated  by  comma,  and
              ranges.  For example, 0,5,7,9-11.
       -h, --help
              display usage information and exit
       -V, --version
              output version information and exit
原文地址:https://www.cnblogs.com/yaos/p/14014104.html