October 24, 2014
 
 
RSSRSS feed

Tip: Prioritizing CPU Cores on Linux

Pick a CPU Core, Any Core

  • December 13, 2010
  • By Joe Brockmeier
Any server made in the last five years or so is going to have at least a dual-core CPU. Linux has a nifty tool to assign specific tasks to a particular core, taskset.
Unless you're using a really old machine or cheap netbook, almost any system you touch with Linux these days is going to be a multiprocessor system. Any server machine deployed within the past five years should have at least two CPUs, and most desktops released in the past three years have at least two cores. For a number of reasons, you might want to "pin" some tasks so they run exclusively on a single CPU or set of CPUs.

Whether you want to ensure resources for a process, ensure that a process doesn't hog all system resources or improve a process that doesn't scale well to multiple CPUs, you can use taskset to assign a task to specific CPUs. It's pretty simple.

Using taskset, you "bond" a process to a CPU. Let's say you want to run Google Chrome on one CPU. You'd run something like this:

Read the rest of Joe Brockmeier's Linux taskset story at ServerWatch.com

Sitemap | Contact Us