Sample Header Ad - 728x90

CPU affinity after process cloning

0 votes
0 answers
33 views
I am cloning a process using the clone() glibc wrapper function. For some unrelated reasons, I need to set the CLONE_THREAD flag bit ON. It implies that > If CLONE_THREAD is set, the child is placed in the same thread group as the calling process. [...] Now, for each process (parent and child), I need to set their CPU core affinity based on some logic. However, calling sched_setaffinity(gettid(), ...) does not seem to be working in the child process. What puzzles me is that each child process is actually scheduled onto the same CPU core ID of its parent process, **even though** the child **calls sched_setaffinity after** its parent . Or better, its parent calls it before it creates the child, so that when the child calls it, it seems the call has no effect. Where's the issue?
Asked by mEm (101 rep)
Nov 26, 2024, 03:15 PM
Last activity: Nov 26, 2024, 03:31 PM