April 20, 2018

Get the Most Out of Your Multicore Processor

Two heads are better than one!

  • September 11, 2009
  • By Akkana Peck

Ooh, shiny! A new machine, and it has a Core 2 Quad processor! Everything's going to run so much faster now!

Or is it? When you have four processor cores, does that mean everything runs four times faster? Or is everything still running on the first CPU and ignoring the others? How do you find out, and how do you make the best use of that shiny new multi-core processor?

Performance Monitors: How busy are your CPUs?

To find out how fully your CPU cores are being used, you have a choice of several performance monitors.

gnome-system-monitor is the easiest to use (Figure 1). The Resources tab shows you a running graph of all your CPUs as well as details on your memory and network use.

Conky (Figure 2) is an alternative that's very popular with the "lightweight desktop" crowd. It can monitor nearly anything, and you can even set it up to display graphs on a transparent background so they look like they're part of your wallpaper.

Unfortunately, by default conky doesn't show each CPU separately, and it's a bit tricky to configure. Here's a minimal .conkyrc to show two cores. If you prefer a transparent background, remove the first line.

own_window yes
TEXT Usage for 2 CPUs
${cpugraph cpu0 000000 ffffff}

${cpugraph cpu1 000000 ffffff}

For more conky screenshots and sample configuration files, see the Conky web page.

For a lightweight monitor that's easier to configure than conky, try xosview (Figure 3). It shows all your CPU cores by default. Of course, you can adjust the display, using the command-line or with X resources. For instance,

xosview -geometry 370x330 +cpu +load +mem -swap -page -ints -disk

gives you something more like Figure 4.

There's also gkrellm (Figure 5). It, too, is highly configurable and has a huge list of plug-ins available.

Finally, if you prefer the command-line, mpstat will give you an overview of how hard your processors are working:

$ mpstat -P ALL
Linux (imbrium) 09/04/2009 _i686_ (2 CPU)

08:59:55 PM CPU %usr %nice %sys %iowait %irq %soft%steal %guest %idle
08:59:55 PM all 6.87 0.06 0.81 0.32 0.01 0.01 0.00 0.00 91.93
08:59:55 PM 0 6.71 0.07 0.80 0.39 0.01 0.02 0.00 0.00 92.00
08:59:55 PM 1 7.03 0.04 0.82 0.25 0.00 0.00 0.00 0.00 91.86

mpstat has lots of other statistics to offer as well: man pstat will give you the details.

Most Popular LinuxPlanet Stories

Sitemap | Contact Us