1

Is there any way we can force a process to migrate to another cpu (force it to run in another cpu). Currently scheduler does the job of migration. Can we use it to forcefully migrate a process? Any specific links related to process migration which clearly defines how to migrate process in linux.

Ivid
  • 203
  • 3
  • 10
  • possibly duplicate of [migrate process to different core](http://stackoverflow.com/questions/35584582/migrating-a-running-process-thread-to-different-core) – vinod maverick Apr 11 '17 at 09:57
  • How is that useful? By the time you have moved the thread of the process to another core and returned from your efforts, the OS may have moved it back again. – ThingyWotsit Apr 11 '17 at 10:42
  • Possible duplicate of [Migrating a running process/thread to different core](http://stackoverflow.com/questions/35584582/migrating-a-running-process-thread-to-different-core) – Tsyvarev Apr 11 '17 at 18:02

1 Answers1

1

This is how to do it for RHEL.

  1. Install tuna

    sudo yum install tuna

  2. Let's say your target process to be moved is a 'dd' running.

  3. Check its current affinity

    tuna -P

You should see in the affinity column that is wants to use multiple cpus

  1. Migrate the whole family of 'dd' processes to a specific CPU, let's say CPU #1 in this example:

    tuna -c 1 -t dd* --move

Use 'top', click '1' and see the current CPU cores load distribution.

You may want to run

tuna -c 0 -t dd* --move

To make sure the 'dd' migrates to CPU #0.