两个名词
SMP (Symmetrical Multi-Processing):指在一个计算机上汇集了一组处理器(多CPU),各CPU之间共享内存子系统以及总线结构。 [更多…]
CPU affinity:中文唤作“CPU亲和性”,是指在CMP架构下,能够将一个或多个进程绑定到一个或多个处理器上运行。[更多…]
请先确定你的cpu核心及命名(例如四个核心:0,1,2,3):cat /proc/cpuinfo
Java代码 收藏代码
taskset -cp 1 5200
#把PID为5200的进程运行到CPU#1上
#也可以在启动进程时指定:
taskset -c 1 /etc/init.d/mysql start
linux taskset命令详解
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