将进程绑定到特定的cpu - taskset命令
2017-10-12 09:57
309 查看
在测试斗地主程序的时候,发现单核cpu的运行时间总比多核cpu运行时间块,用taskset命令一看,果然是一个进程运行在两个cpu上。
最后在将一个进程固定到cpu上貌似没啥效果,么有找到原因。不知道和单核机器和多核机器的gcc版本有没有关系
Score of team 1 is : -1154 Score of team 2 is : 148 Score of team 3 is : 1006 real 4m12.768s user 0m12.307s sys 0m2.703s [root@ying ~]# ps -aux | grep dou root 30958 18.0 0.4 15508 4112 pts/0 S+ 09:14 0:00 ./doudizhu_platform root 30960 0.0 0.0 9028 660 pts/1 R+ 09:14 0:00 grep --color=auto dou [root@ying ~]# taskset -p 30958 pid 30958's current affinity mask: 1
Score of team 1 is : -1100 Score of team 2 is : 568 Score of team 3 is : 532 real 6m41.709s user 0m7.428s sys 0m2.776s root@10.63.93.13:~# ps -aux | grep dou root 2314 2.5 0.9 177940 161356 pts/1 S+ 09:06 0:09 ./doudizhu_platform root 26076 0.0 0.0 12180 704 pts/2 S+ 09:13 0:00 grep --color=auto dou root@10.63.93.13:~# taskset -p 2314 pid 2314's current affinity mask: ff root@10.63.93.13:~# taskset -p 2314 pid 2314's current affinity mask: ff
最后在将一个进程固定到cpu上貌似没啥效果,么有找到原因。不知道和单核机器和多核机器的gcc版本有没有关系
Score of team 1 is : -182 Score of team 2 is : 97 Score of team 3 is : 85 real 6m44.039s user 0m7.668s sys 0m2.568s root@10.63.93.13:~# ps -aux | grep dou root 16842 2.3 0.0 19628 2988 pts/1 S+ 09:29 0:00 ./doudizhu_platform root 22093 0.0 0.0 12176 704 pts/2 S+ 09:29 0:00 grep --color=auto dou root@10.63.93.13:~# taskset -pc 0 16842 pid 16842's current affinity list: 0-7 pid 16842's new affinity list: 0 root@10.63.93.13:~# taskset -p 16842 pid 16842's current affinity mask: 1
相关文章推荐
- 利用taskset命令,将某进程绑定到某个CPU上
- linux taskset命令与node.js(进程cpu绑定)
- linux下使用taskset设置进程cpu绑定不起作用
- linux进程cpu资源分配命令nice,renice,taskset
- 记录一个多核CPU负载不均衡问题(动态绑定进程到指定cpu:taskset -pc $CPU $PID)
- linux进程cpu资源分配命令nice,renice,taskset
- linux shell 查看进程运行或绑定的cpu和绑定执行进程到特定cpu上执行的方法
- linux进程cpu资源分配命令nice,renice,taskset
- 使用taskset命令来限制进程的CPU
- 设置cpu亲和性---即 绑定特定的进程线程到指定的cpu
- 进程启动后使用taskset进行cpu绑定
- 设置cpu亲和性---即 绑定特定的进程线程到指定的cpu
- Linux 进程绑定CPU用taskset
- linux下通过使用taskset命令来限制进程的CPU
- Aix命令:列出使用内存和Cpu前几位的进程
- Linux下进程绑定多CPU运行
- 使用ps命令查看使用内存或CPU最多的10个进程
- Ubuntu系统进程绑定CPU核
- Nginx 关于进程数 与CPU核心数相等时,进程间切换的代价是最小的-- 绑定CPU核心
- LINUX将制定的线程号、进程号绑定到指定CPU核上