Limit number of cpu cores to be activated

Lets suppose you would like to restrict number of CPU to be activated on your linux machine for some software licensing issues under Linux kernel 2.6.x.

Practically this is useful to test different software performances and configurations. Even some commercial software like ERP software or Oracle are licenced per CPU. In that case if I will be using all the cpu’s that are in my machine, its going to cost be earth. Like I have Intel i7 processor in my laptop, so that means 8 cpu cores. And if I am planning to deploy oracle on this machine, then I need to buy licence for 8 cores. Which I might not need, and further the cost will shoot upwards like a Virender Sehwag sixers.

There is a parameter maxcpus, which can be a life saver. Using maxcpus, you can limit the number of CPUs activated in SMP mode.

All you need to do is to just modify your /boot/grub/grub.conf file and pass maxcpus=X (here X is the number of cpu cores you want to get activated) to kernel. It specify maximum number of processors that an SMP Linux kernel should make use of.

Below is the screen shots from my virtual machines, very carefully combined into one single picture for easy understanding. (I deserve “like” at least for the copy paste thing in this pic).

Enjoy learning with Network NUTS.


maxcpus kernel parameter to limit number of cpu cores to be activated

maxcpus kernel parameter to limit number of cpu cores to be activated