Monday, August 18, 2008

Enabling Multiple CPUs (SMP) in Ubuntu

Many of today's computers have multiple CPUs. Some are physically distinct, and others are virtual, such as hyper-threading and dual-core. In any case, these processors support symmetric multiprocessing (SMP) and can dramatically speed up Linux.

The kernel supports multiple CPUs and hyper-threading. If your computer has two CPUs that both support hyper-threading, then the system will appear to have a total of four CPUs.

Older versions of Ubuntu, such as Hoary and Breezy, had different kernels available for SMP. To take advantage of multiple processors, you would need to install the appropriate kernel.

sudo apt-get install kernel-image-2.4.27-2-686-smp

Without installing an SMP kernel, you would only use one CPU on an SMP system.

Dapper changed this requirement. Under Dapper, all of the default kernels have SMP support enabled. The developers found that there was no significant speed impact from using an SMP kernel on a non-SMP system, and this simplified the number of kernels they needed to maintain.

There are a couple of ways to tell if your SMP processors are enabled in both the system hardware and kernel.

• /proc/cpuinfo-This file contains a list of all CPUs on the system.

• top-The top command shows what processes are running. If you run top and press 1, the header provides a list of all CPUs individually and their individual CPU loads. (This is really fun when running on a system with 32 CPUs. Make sure the terminal window is tall enough to prevent scrolling!)

• System Monitor-The System Monitor applet can be added to the Gnome panels. When you click it, it shows the different CPU loads.

In each of these cases, if only one CPU is listed, then you are not running SMP. Multiple CPUs in the listings indicate SMP mode.

Disabling SMP
In some situations, such as application benchmarking or hardware debugging, you may want to disable SMP support. This can be done with the kernel parameters nosmp or maxcpus=1.If this is a temporary need, you can just boot the system, catch Grub at the menu by pressing ESC, and typing boot nosmp maxcpus=1 at the prompt. If you have multiple boot options, then you may need to edit the kernel line and add nosmp maxcpus=1 to the kernel boot line. Warning, some kernels do not work with nosmp, but in my experience maxcpus=1 always works.

For a longer-term solution, consider adding these boot parameters to the Grub configuration.

1. As root, edit /boot/grub/menu.lst.

2. Scroll down to your kernel.

3. Add a kernel option for disabling SMP. For example: kernel /boot/vmlinuz-2.6.15-26-686 root=/dev/hda1 ro splash maxcpus=1

4. Save your changes.

The next reboot will use your new changes. If you modify /boot/grub/menu.lst, be aware that the contents could be overwritten the next time you upgrade the kernel or run update-grub.

SMP not working
If you find that you only have one active CPU on a multiple CPU system, try installing the explicit SMP kernel: sudo apt-get install linux-686-smp. Beyond that, there are few generic debugging options and the problem is unlikely related to Ubuntu-it is probably a general Linux kernel problem.

Check with the motherboard manufacturer and see if Linux supports their chipset. For example, I have an old dual-CPU motherboard that is not supported by Linux.

Check the Linux Hardware FAQ for the motherboard or chipset. This will tell you if other people managed to get it to work. Web sites such as and/ are good places to start.

If all else fails, post a query to any of the Linux or Ubuntu hardware forums. Maybe someone else knows a workaround. Some good forums include,, and Be sure to include details such as the make and model of the motherboard, Ubuntu version, and other peripherals. It is generally better to provide too much information when asking for help, rather than providing too little.

Unfortunately, if SMP is not enabled after installing the linux-686-smp kernel, then it probably will not work. But you might get lucky-if someone has a patch then you will probably need to recompile the kernel.

Source of Information : Hacking Ubuntu Serious Hacks Mods and Customizations

No comments: