Super User is a question and answer site for computer enthusiasts and power users. 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

When I run a vm with a single virtual CPU inside KVM, is it possible that the vm can actually get more CPU cycles than one whole CPU can has, if there is no other vm running in the host? In another word, can the vm get more CPUs than it has? I does no CPU bandwidth limit for my vm.

Since the Linux scheduler (CFS) is work conserving, if i understand correctly, the scheduler shall always be busy if there is some work to do. In this case, some threads in my vm.

If indeed the vm can actually has more than one CPUs serving for it, how is its CPU utilization reported by vm? >100%, or simply 100%. How is the number of CPUs in the /proc/cpuinfo of the vm?

I think it is an interesting question, or maybe a stupid question. I plan to do some experiments if no answer arrives.

Thanks in advance. Zhen

share|improve this question
Do the experiments. I suspect that a single CPU will get a single thread and that it will never be faster then a single core on yout real CPU. If you have 2 core 'real hardware' and 1 core int he vm that would use up to 50% (1/2) of your real CPU power. With 2 core up to 100%. With three virtual cores up to 100% (well, more is not possible) but with the virtual cores performing worse. (FOr simplicity: up to 2/3th speed, but in practise a bit less due to extra overhead) – Hennes Aug 11 '12 at 18:00

Tested, the result shows that the guest can NOT get more CPU than it demands, even if the Linux scheduler is work-conserving.

I did some simple experiments using a micro-benchmark that basically spins the CPU. The host is dual core machine running KVM with a single guest vm.

I run multiple benchmark application in the guest vm simultaneously to see whether it can grab more CPU than it deserves. The result is as follows:

  • When the vm is configured with 1 virtual CPU, sar reports ~100% CPU utilization in the vm and ~50% in the host. Top command in the host shows 2 KVM threads.

  • When the vm is configured with 2 virtual CPUs, sar reports ~100% CPU utilization in the vm and ~100% in the host. Top command in the host shows 3 KVM threads.

So my theory is that KVM will assign a single thread for each virtual CPU, and an extra thread is used for some management activity. So the vm with single virtual CPU cannot be serviced in multiple CPUs of host simultaneously.

It turns out a stupid question :)

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.