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?
Asked
Active
Viewed 3,228 times
6
Ciro Santilli Путлер Капут 六四事
- 302,449
- 85
- 1,093
- 879
user424060
- 1,505
- 3
- 18
- 29
-
1If nothing else you could probably de-link the parent process before forking the child, and then re-link it again afterwards... – Jeremy Friesner Dec 01 '11 at 03:36
1 Answers
8
You can call sched_setaffinity(2) with all bits set in CPU mask after the fork(2) and before the execve(2).
Nikolai Fetissov
- 79,853
- 11
- 109
- 168