How can I move a process to a core or dedicate a process to a processor?

Based on your comment on MikeyB's answer you're trying to solve this the wrong way IMHO --

Both numactl and taskset will lock your process to a CPU, but they won't keep other processes off that CPU.
If someone else is on that CPU when your process needs it you will have to wait.

A better solution is to set your process' nice value to something that will cause it to aggressively grabt he CPU (something like -20), and if that's still not enough set your process to realtime priority using rtprio, and let the scheduler do what it has to do to make sure that your process always has CPU cycles when it asks for them.

Trying to outsmart the scheduler is, as MikeyB pointed out, generally a Bad Idea. Let it do what it's designed to do, and ask for CPU cycles the RIGHT way (nice values and rtprio).


numactl allows you to bind a process to a core or physical CPU as well as forcing a memory allocation policy.

Usually, this is not necessary. Stop trying to outsmart the scheduler.


If you have it installed you can use the taskset command e.g.

taskset -c 2 -p 2345 

to run process 2345 on cpu 2