当前位置:网站首页>如何将进程绑定到指定的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
边栏推荐
- presto日期函数的使用
- go语言:在函数间传递切片
- Discussion on frame construction and technology selection of short video platform
- 在项目中的定时作用
- Detailed explanation of device tree
- PyTorch 17. GPU concurrency
- pytorch:关于GradReverseLayer实现的一个坑
- Error in multi machine and multi card training
- quill-editor图片缩放、在一个页面使用多个富文本框、quill-editor上传图片地址为服务器地址
- Metro wireless intercom system
猜你喜欢
随机推荐
可视化之路(十二)Collection类详解
PyTorch 10. Learning rate
关于短视频技术轮廓探讨
el-date-picker中自定义快捷选项picker-options,动态设置禁用日期
van-uploader上传图片实现过程、使用原生input实现上传图片
数据分析学习(一)数据分析和Numpy基础
可视化常见问题解决方案(八)共享绘图区域问题解决方案
Jupyter Notebook 安装
el-select 中v-model绑定值,数据回显只显示value,不显示label
x86架构初探之8086
可视化常见绘图(四)柱状图
带您遨游太空,美摄科技为航天创意小程序提供全面技术支持
How does the public and Private Integrated walkie talkie realize cooperative work under multi-mode communication?
传输层重要知识(面试,复试,期末)
在项目中的定时作用
Error in multi machine and multi card training
Swin transformer to onnx
Emergency communication system for flood control and disaster relief
社区版阿里MQ普通消息发送订阅Demo
Detailed explanation of device tree