How well does Linux support multi-core CPUs?

Q With the low cost of dual- and quad-core processors, I am interested in how Linux will be able to access and use this technology now and in the near future. I have done some looking, and while some information is available, I was unable to determine how it would benefit me on a Linux desktop computer. Also is there one particular distro or version of Linux better at implementing the new processors than other versions?

A Linux has supported multiple processors (or processor cores) for some years: I am writing this on a Core2Duo system (although Kate doesn't really need all the power of both cores to check even my spelling). Most distros support multiple processors out of the box, the important criterion is that the kernel has been build with SMP (Symmetric multiprocessing) support. Some distros enable this in their generic kernel, others have a separate SMP-enabled kernel that is used when the installer detects more than one CPU core. There are a number of easy checks for SMP support; does the output from

cat /proc/cpuinfo

shows a figure for "cpu cores"? Try running top in a terminal and pressing 1 (that's the number one, not the letter L), which should toggle the CPU usage display between showing an overall figure and individual CPU loads. Running

zgrep SMP /proc/config.gz

will show CONFIG_SMP=y if SMP support is enabled, providing your kernel has support for /proc/config.gz, otherwise you'll see an error that tells you nothing. SMP support in the kernel means improved multitasking, as programs can be run on whichever processor has the least load, but most individual programs still use only one processor. However, some CPU-intensive programs can split their load between more than one CPU core. For example, the -threads option for ffmpeg will split a video transcoding task across the given number of processors for a substantial reduction in processing time. Software compilation can also benefit, as most programs have a lot of smaller files that need to be compiled and this can be done in parallel.

By setting the MAKEOPTS environment in your profile to -j3 for a dual core system, or -j5 for quad core, programs will usually compile much faster. Note that the number used here is usually one more than the number of CPUs (-j2 is used for single processor systems) to ensure the processors are loaded most effectively. If you are going to load the system with intensive tasks like software compilation or video transcoding, try using the nice command (see the Quick Reference box on page 108) to keep your desktop responsive while this is going on.

Back to the list