bash - Processor affinity on Linux using taskset -
i have following code in bash script:
echo "bash pid => $$"; echo "processor affinity before => $(taskset -p $$)" taskset -cp ${an_integer} $$ echo "processor affinity after => $(taskset -p $$)" i output:
processor affinity before => pid 5047's current affinity mask: ff pid 5047's current affinity list: 0-7 pid 5047's new affinity list: 1 processor affinity after => pid 5047's current affinity mask: 2 does know means?
the reason started messing processor affinity because launch multiple bash child processes, , bash child process affinities had value "ff" seemed targeting same cpu.
the affinity mask controls set of processors process may run on - not single specific processor. bits 1 in mask mean represent processor process can run on. since specified want process run on cpu 1, affinity mask 0b00000010, or 2.
Comments
Post a Comment