Yes.
SMP is supported in 2.0 on the hypersparc (SS20, etc.) systems and Intel 486, Pentium or higher machines which are Intel MP1.1/1.4 compliant. Richard Jelinek adds: right now, systems have been tested up to 4 CPUs and the MP standard (and so Linux) theoretically allows up to 16 CPUs.
SMP support for UltraSparc, SparcServer, Alpha and PowerPC machines is in progress in 2.1.x.
MIPS, m68k and ARM does not support SMP; the latter two probly won't ever.
That is, I'm going to hack on MIPS-SMP as soon as I get a SMP box ...
Uncomment the SMP=1
line in the main Makefile
(/usr/src/linux/Makefile
).
AND
enable "RTC support" (from Robert G. Brown). Note that inserting RTC support actually doesn't afaik prevent drift, but according to a discussion [Robert G. Brown] remember from a year ago or so it can prevent lockup when the clock is read at boot time. A note from Richard Jelinek says also that activating the Enhanced RTC is necessary to get the second CPU working (identified) on some original Intel Mainboards.
AND
do NOT enable APM! APM and SMP are not compatible, and your system will
almost certainly (or at least probably ;)
) crash under boot if
APM is enabled (Jakob Oestergaard). Alan Cox confirms
this : 2.1.x turns APM off for SMP boxes. Basically APM is undefined in
the presence of SMP systems, and anything could occur.
You must rebuild all your kernel and kernel modules when changing to and
from SMP mode. Remember to make modules
and make
modules_install
(from Alan Cox).
Comment the SMP=1
line in the Makefile (and not set SMP to
0).
You must rebuild all your kernel and kernel modules when changing to and
from SMP mode. Remember to make modules
and make
modules_install
.
cat /proc/cpuinfo
Typical output (dual PentiumII):
processor : 0 cpu : 686 model : 3 vendor_id : GenuineIntel stepping : 3 fdiv_bug : no hlt_bug : no fpu : yes fpu_exception : yes cpuid : yes wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic 11 mtrr pge mca cmov mmx bogomips : 267.06 processor : 1 cpu : 686 model : 3 vendor_id : GenuineIntel stepping : 3 fdiv_bug : no hlt_bug : no fpu : yes fpu_exception : yes cpuid : yes wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic 11 mtrr pge mca cmov mmx bogomips : 267.06
2.1.x has signal handling, interrupts and some I/O stuff fine grain locked. The rest is gradually migrating. All the scheduling is SMP safe
No and Yes. There is no way to force a process onto specific CPU's but the linux scheduler has a processor bias for each process, which tends to keep processes tied to a specific CPU.
If you have to ask, you probably don't. :)
Thanks to Samuel S. Chessman, here is some useful utilities:
http://www.cs.inf.ethz.ch/~rauch/procps.html
Basically, it's procps v1.12.2 (top, ps, et. al.) and some patches to support SMP.
xosview-1.5.1 supports SMP. And kernels above 2.1.85 (included) have the /proc/stat/cpuX entry.
The official homepage for xosview is: http://lore.ece.utexas.edu/~bgrayson/xosview.html
The various forissier's kernel patches are at: http://www-isia.cma.fr/~forissie/smp_kernel_patch/
Use a kernel-thread library. A good library, the pthread library made by Xavier Leroy.
LinuxThread is now integrated with glibc2 (aka libc6).
From Jakob Oestergaard: Also consider using MPI. It's the industry standard message passing interface. It doesn't give you shared memory like threads, but it allows you to use your program in a cluster too.
Glibc is the big change. glibc is threadsafe and includes linuxthreads Posix.4 threads by default. Real time signals are also in glibc so POSIX AIO should also be in glibc2.1 (I hope).
use:
# make [modules|zImage|bzImages] MAKE="make -jX" where X=max number of processes. WARNING: This won't work for "make dep".
With a 2.1.x like kernel, see also the file
/usr/src/linux/Documentation/smp
for specific instruction.
BTW, since running multiple compilers allows a machine with sufficient
memory to use use the otherwise wasted CPU time during I/O caused delays
make MAKE="make -j 2" -j 2
actually even helps on uniprocessor
boxes (from Ralf Bächle).
time
command is false ?
(from Joel Marchand)
In the 2.0 series, the result given by the time
command is
false. The sum user+system is right *but* the spreading between user and
system time is false.
This bug in corrected in 2.1 series.
Look at SMP Performance of Linux which gives useful hints how to bench a specific machine (from a post made by Cameron MacKinnon).
Look at the Linux Parallel Processing HOWTO
Lots of useful information can be found at Parallel Processing using Linux