Short bio: Computer Scientist, FOSS supporter (read more)
Tux Machines (TM)-specific
Ever since the /proc file system first made an appearance on Unix systems, getting information on running processes became a whole lot easier. The useful, but too often insufficient information available in the output of ps commands was thoroughly upstaged by /proc which acts as an interface to kernel data structures. /proc provides interfaces to kernel data structures that can supply information on how memory is being used, what devices are mounted, which file descriptors are in use, and what command line arguments were used with running processes -- and that's just a start. On Linux systems, /proc also contains information on the system's processors. It sits in a file called cpuinfo.
To find out how many processors you have, for example, look through /proc/cpuinfo for lines containing the string "physical id". You can grab this with grep and then pass that information through a couple handy filters like this to get a count: