taskset inside qemu virtual machine not working as expected

699 Views Asked by At

I am emulating qemu for linux x86-64. In qemu virtual machine, I am using

taskset -c 0 prc1 & taskset -c 1 prc2 & taskset -c 2 prc3 &  taskset -c 3 prc4;

to simultaneously issue 4 processes and bind them to four cores (prc is short for process). However, I find that once they start running; then afterwards, in-between, some cores (say 1 and 2) do not execute those processes but either idle or do something else. Can you suggest, what could be the reason for this or a way of improvement so that, I can make sure processes don't migrate from one core to another.

1

There are 1 best solutions below

0
On BEST ANSWER

The processes aren't migrating from one core to another. Whenever they need CPU, they will only get the core you bound them to. That won't prevent the CPUs from doing other work, nor will it somehow force a process use a core even when it cannot run, say because it's waiting for I/O.