简体   繁体   English

如何防止子分叉进程继承CPU亲和力?

[英]How to prevent inheriting CPU affinity by child forked process?

I have a server process that forks many child processes. 我有一个服务器进程,它会分叉许多子进程。 The server process has affinity to a CPU core, but I don't want that affinity to be inherited by child process (rather OS should handle where to run these processes). 服务器进程与CPU核心具有亲缘关系,但我不希望子进程继承该亲和性(而OS应该处理运行这些进程的位置)。 Is there a way to delink parent child processes with respect to cpu affinity? 有没有办法将父子进程与cpu亲和关系脱钩?

您可以在fork(2)execve(2)之前使用CPU掩码中设置的所有位调用sched_setaffinity(2) execve(2)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM