由子进程继承的Cpu亲和力 [英] Cpu affinity inherited by child process

查看:328
本文介绍了由子进程继承的Cpu亲和力的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个服务器进程,分叉许多子进程,服务器进程与cpu核心的亲和力,我不希望该亲和性被子进程继承(而不是os应该在哪里运行这些进程)。有没有办法脱离父进程与cpu亲和关系?

I have a server process that forks many child processes, server process has affinity to cpu core, i don't want that affinity to be inherited by child process (rather os should handle where to run these processes). Is there a way to delink parent child processes with respect to cpu affinity?

感谢

推荐答案

您可以致电 sched_setaffinity(2) 所有位在 fork(2) 之前, execve(2)

You can call sched_setaffinity(2) with all bits set in CPU mask after the fork(2) and before the execve(2).

这篇关于由子进程继承的Cpu亲和力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆