Whole one core dedicated to single process Whole one core dedicated to single process linux linux

Whole one core dedicated to single process


Yes there is. In fact, there are two separate ways to do it :-)

Right now, the best way to accomplish what you want is to do the following:

  1. Add the parameter isolcpus=[cpu_number] to the Linux kernel command line from the boot loader during boot. This will instruct the Linux scheduler not to run any regular tasks on that CPU unless specifically requested using cpu affinity.

  2. Use IRQ affinity to set other CPUs to handle all interrupts so that your isolated CPU will not receive any interrupts.

  3. Use CPU affinity to fix your specific task to the isolated CPU.

This will give you the best that Linux can provide with regard to CPU isolation without out-of-tree and in-development patches.

Your task will still get interrupted from time to time by Linux code, including other tasks - such as the timer tick interrupt and the scheduler code, IPIs from other CPUs and stuff like work queue kernel threads, although the interruption should be quite minimal.

For an (almost) complete list of interruption sources, check out my page at https://github.com/gby/linux/wiki

The alternative method is to use cpusets which is way more elegant and dynamic but suffers from some weaknesses at this point in time (no migration of timers for example) which makes me recommend the old, crude but effective isolcpus parameter.

Note that work is currently being done by the Linux community to address all these issues and more to give even better isolation.


There is Redhat article talking about it. It modifies the boot parameter isolcpus.

And an old article written by Robert Love. And there is solution in that article.

All of a process' children receive the same CPU affinity mask as their parent.

Then, all we need to do is have init bind itself to one processor. All other processes, by nature of init being the root of the process tree and thus the superparent of all processes, are then likewise bound to the one processor.


Dedicate a Whole CPU Core to a Particular Program

While taskset allows a particular program to be assigned to certain CPUs, that does not mean that no other programs or processes will be scheduled on those CPUs. If you want to prevent this and dedicate a whole CPU core to a particular program, you can use "isolcpus" kernel parameter, which allows you to reserve the CPU core during boot.

Add the kernel parameter "isolcpus=" to the boot loader during boot or GRUB configuration file. Then the Linux scheduler will not schedule any regular process on the reserved CPU core(s), unless specifically requested with taskset. For example, to reserve CPU cores 0 and 1, add "isolcpus=0,1" kernel parameter. Upon boot, then use taskset to safely assign the reserved CPU cores to your program.

Source(s)

  1. http://xmodulo.com/2013/10/run-program-process-specific-cpu-cores-linux.html
  2. http://www.linuxtopia.org/online_books/linux_kernel/kernel_configuration/re46.html