当前位置:网站首页>如何将进程绑定到指定的CPU上
如何将进程绑定到指定的CPU上
2022-04-23 06:18:00 【发呆的小球童】
//绑定当前进程到cpu0执行
cpu_set_t mask;
CPU_ZERO(&mask); //将CPU集清空
CPU_SET(0,&mask);//将CPU0加入CPU集中
if(sched_setaffinity(getpid(), sizeof(cpu_set_t), &mask) == -1) //将当前进程与CPU集绑定
{
printf("warning: could not set CPU affinity, continuing...\n");
}
参考资料:
https://blog.csdn.net/wangquan1992/article/details/104860237
https://www.linuxidc.com/Linux/2015-04/116867.htm
https://mp.weixin.qq.com/s/inKtafw7reHmRqhwvcxi9w
版权声明
本文为[发呆的小球童]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_44548016/article/details/120866229
边栏推荐
猜你喜欢
Detailed explanation of unwind stack backtracking
不需要破解markdown编辑工具Typora
SDC intelligent communication patrol management system of Nanfang investment building
Discussion on the outline of short video technology
网络层重要知识(面试、复试、期末)
可视化常见问题解决方案(九)背景颜色问题
Are realrange and einsum really elegant
Urban emergency management - urban emergency communication command and dispatching system
quill-editor图片缩放、在一个页面使用多个富文本框、quill-editor上传图片地址为服务器地址
Solution of self Networking Wireless Communication intercom system in Beifeng oil and gas field
随机推荐
带您遨游太空,美摄科技为航天创意小程序提供全面技术支持
presto日期函数的使用
PyTorch 14. Module class
Hanlp分词器(通过spark)
# 可视化常见绘图(二)折线图
记录一些npm 有关的问题(杂乱记录)
STM32多路测温无线传输报警系统设计(工业定时测温/机舱温度定时检测等)
按需引入vant组件
可视化常见问题解决方案(九)背景颜色问题
SDC intelligent communication patrol management system of Nanfang investment building
项目文件“ ”已被重命名或已不在解决方案中、未能找到与解决方案关联的源代码管理提供程序——两个工程问题
SQL练习第一题
Solution of emergency communication system for major security incidents
Typora语法详解(一)
机器视觉系列(02)---TensorFlow2.3 + win10 + GPU安装
基于openmv的无人机Apriltag动态追踪降落完整项目资料(labview+openmv+apriltag+正点原子四轴)
可视化常见绘图(三)面积图
带低压报警的51单片机太阳能充电宝设计与制作(完整代码资料)
GIS实用小技巧(三)-CASS怎么添加图例?
基于51单片机的三路超声波测距系统(定时器方式测距)