numcpus - Prints out the number of CPUs in your system

Certainly works on Linux 2.2+, Solaris 8+, Windows 2k, and Windows XP. Probably should work on AIX, Cray, HP-UX, Tru64 Unix, and the rest...


Public Domain. However, if you find it useful, please consider forking out for something on my amazon wishlist


$ cc -o numcpus numcpus.c

$ mv numcpus /wherever/bin/numcpus

If you have a half-decent make implementation you can probably just run:

$ make numcpus

This technique certainly works with GNU make.


Just run it and it will print out as much info as it can get on the processor configuration. This varies a lot from platform to platform.

If you know of a way to detect this information on a platform this code does not work on, or you know how to get extended info on a particular platform, please drop me an email. My address is
Icon  Name                    Last modified      Size  Description
[PARENTDIR] Parent Directory - [TXT] README.html 2003-06-16 21:02 1.1K [TXT] numcpus.c 2003-01-29 19:40 2.5K
Apache Server at Port 80