Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a CentOS 6 host for several KVM VMs with FreeBSD as guest.

I want to bind each VM to use no more than one core at once. What would you suggest to use, Cgroups or Tasksets?

share|improve this question

I think cgroups are the preferred method with EL6 now, especially with virtualization. Taskset is best for individual processes, but cgroups are closer to the notion of shielding/containers.

share|improve this answer

If you are using libvirt, you could use:

  <vcpu placement='static' cpuset="1" current="1">2</vcpu>

in the domain XML definition. Some interesting places with relevant info:

share|improve this answer

For binding Vms to CPUs taskset is the right approach. cgroups are there for finer grained resource management, dealing in CPU usage shares. And of course @rubiojr already mentioned the libvirt native way of pinning vCPUs CPUs

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.