0

Is there any way to migrate a currently running process to a different cpu core by triggering the migration from another process.

Here is what i am trying to do in more detail. I am working on a heterogeneous processor system. I have a multi-threaded application which runs on the system. I want to migrate one of the thread to different cores (with different capabilities) whenever my manager process decides.

Can my manager process trigger the thread migration for the particular tid of the target application pid? If so, can it be done instantaneously i.e the running thread be immediately migrated to another core (say from core 0 to core 1) upon triggered by my manager process?

matrix
  • 11
  • 2

1 Answers1

1

I guess this should be possible (if you are using the POSIX threads API) using pthread_setaffinity_np(3):

The pthread_setaffinity_np() function sets the CPU affinity mask of the thread thread to the CPU set pointed to by cpuset. If the call is successful, and the thread is not currently running on one of the CPUs in cpuset, then it is migrated to one of those CPUs.

gollum
  • 2,472
  • 1
  • 18
  • 21