利用taskset命令,将某进程绑定到某个CPU上

发布时间:2020-04-08 18:21:11 作者:SoulMio
来源:网络 阅读:105
taskset (util-linux-ng 2.17.2)
usage: taskset [options] [mask | cpu-list] [pid | cmd [args...]]
set or get the affinity of a process
  -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

例:

将pid号为2181的进程绑定到cpu0上:

[root@Centos ~]# taskset -cp 0 2181
pid 2181's current affinity list: 0
pid 2181's new affinity list: 0

将pid号为2181的进程绑定到几个cpu上:

[root@Centos ~]# taskset -cp 0,1 2181  --绑定到cpu0和cpu1上


推荐阅读:
  1. Java进程将CPU或负载拉高及快速定位脚本
  2. 实现Linux 进程绑定CPU 技术

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

进程 taskset 绑定到cpu

上一篇:7内置数据结构_dict

下一篇:基于django的视频点播网站开发-step4-首页功能

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》