Language Selection

English French German Italian Portuguese Spanish

Counting processors on your Linux box

Filed under

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:

rest here

More in Tux Machines

Alpine Linux 3.4.5 Released with Linux Kernel 4.4.27 LTS, Latest Security Fixes

A new maintenance update of the server-oriented Alpine Linux 3.4 operating system has been released, bringing a new Linux kernel version from the long-term supported 4.4 series and the latest security patches. Read more

DebEX Distro Now Lets You Create an Installable Debian 9 Live DVD with Refracta

After informing us of the release of Exton|OS Light Build 161021, today, October 26, 2016, GNU/Linux developer Arne Exton sent an email to announce the availability of DebEX Barebone Build 161025. The latest version of the DebEX Barebone GNU/Linux distribution, build 161025, is here, based on the soon-to-be-released Debian GNU/Linux 9 "Stretch" (Debian Testing) operating system and kernel 4.8.0-21-exton, a specially crafted Linux kernel package based on the latest stable Linux 4.8 kernel. Read more Just released: KNOPPIX 7.7.1 Public Release

Linux Kernel News

  • BUS1 Kernel Message Bus Posted For Review
    David Herrmann has posted the initial patches for review of the BUS1 kernel message bus, the successor to KDBUS as an in-kernel IPC mechanism. Herrmann announced, "This proposal introduces bus1.ko, a kernel messaging bus. This is not a request for inclusion, yet. It is rather an initial draft and a Request For Comments. While bus1 emerged out of the kdbus project, bus1 was started from scratch and the concepts have little in common. In a nutshell, bus1 provides a capability-based IPC system, similar in nature to Android Binder, Cap'n Proto, and seL4. The module is completely generic and does neither require nor mandate a user-space counter-part."
  • Linux 4.9 Is Going To Be The “Biggest Ever” Linux Release
    The next Linux kernel release, i.e., Linux 4.9, could be the biggest ever Linux release in terms of the commits. Linus Torvalds shared this news in the release announcement of Linux 4.9-rc2. He also hinted at the possibility of turning 4.9 into an LTS release. The final build of the kernel is expected to arrive in December.

Quirky 8.1 Linux Is Built with Ubuntu 16.04 Binary DEBs, Supports Raspberry Pi 3

Puppy Linux developer Barry Kauler was happy to announce the general availability of his Quirky 8.1 "Xerus" GNU/Linux distribution built with binary DEB packages from the Ubuntu 16.04 LTS (Xenial Xerus) operating system. Quirky 8.1 "Xerus" is here to replace the old "April" series, and while it is indeed built using the binary DEBs of Ubuntu 16.04 LTS, it stays true to being a distro from the Puppy Linux family and not an Ubuntu clone. However, it lets users install packages from the official Ubuntu 16.04 LTS (Xenial Xerus) software repositories, a feature that was not available in the Quirky "April" releases. Read more