Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Taskset in linux

If we are using the taskset for setting the particular process to run on a particular core by using the process pid. I want to know that all the child processes which will generated by the pid will also run on the particular core or uses any core.

like image 408
Rishabh Gupta Avatar asked Jul 28 '26 07:07

Rishabh Gupta


1 Answers

taskset calls sched_setaffinity(2) (here) to specify the set of CPUs a thread is eligible to run on. As sched_setaffinity(2)'s manual states:

A child created via fork(2) inherits its parent's CPU affinity mask. The affinity mask is preserved across an execve(2).

the child processes are allowed to run on the same set of CPUs as their parent.

like image 115
someneat Avatar answered Jul 30 '26 08:07

someneat