Sujet : Setting child proc affinity before fork() ? De : Muttley (at) *nospam* dastardlyhq.com Groupes :comp.unix.programmer Date : 31. May 2025, 17:46:48 Autres entêtes Organisation : A noiseless patient Spider Message-ID :<101fbpo$19jus$1@dont-email.me>
The CPU_* macros and sched_setaffinity() etc allow you to try and force a given process to run on a given CPU/core , but is there a way to set the affinity of a process yet to be created by fork() ? Eg if I have a parent process running on CPU 0 can I make it so that the child will run on CPU 1 before the child is created so that the child itself doesn't have to set the affinity? I'm thinking of situations with fork-exec when the exec'd binary won't set any affinity so the parent needs to do it for it.