How to prevent inheriting CPU affinity by child forked process?

ⅰ亾dé卋堺 提交于 2019-11-27 06:56:09

问题


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). Is there a way to delink parent child processes with respect to cpu affinity?


回答1:


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



来源:https://stackoverflow.com/questions/8336191/how-to-prevent-inheriting-cpu-affinity-by-child-forked-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!