Использование процессора в виртуальных машинах

7951
pauliwago

У меня есть хост-машина с 1 логическим процессором, работающим на частоте 2,0 ГГц, с работающими 2 виртуальными машинами. Каждая виртуальная машина работает на 100% (согласно диспетчеру задач внутри виртуальной машины). Я понимаю, что это «100%» не является точным в том смысле, что фактически каждая виртуальная машина использует около 50% доступных ресурсов ЦП хост-машины. Только если я остановлю одну из виртуальных машин, работающая виртуальная машина действительно будет использовать 100% физического процессора.

Как работает этот процесс? Если физический процессор работает на частоте 2,0 ГГц, мы создаем два виртуальных процессора, каждый из которых работает на частоте 1,0 ГГц? Итак, когда мы видим 100% загрузку на обеих виртуальных машинах, мы говорим о 100% 1,0 ГГц на каждой? Как этот процент использования получается в первую очередь?

Спасибо!

1

2 ответа на вопрос

3
David Schwartz

The usage that you see inside the virtual machine is the percentage of the time it wanted the CPU, whether it got it or not. Essentially, 100% means 100% of the CPU available to that virtual machine.

If the physical processor runs at 2.0GHz, then so do the virtual processors. However, because there is only one actual core, only one of the virtual processors can be running at a time. When you see 100% utilization on both VMs, you are talking about each VM always wanting as much CPU as it can get. Typically, they will each get close to 50% of the available CPU.

Don't say things like this: "So when we see 100% utilization on both VMs, we are talking about 100% of 1.0GHz on each?" That's basically nonsense. If you get to use a car that goes 50 miles per hour every other day, we don't describe that as 100% of 25 miles per hour. Rates don't work that way. The CPU has some capacity to do work, and the virtual machines share that. If each wants all they can get, then each gets around 50% of the CPU's capacity to do work. 2.0GHz is the core clock speed, not the capacity to do work. So it makes no sense to divide that.

1
Gabrie

On a physical CPU core there can only run one VM at a time. The vmkernel switches the cpu core between VMs very fast. To you it looks as if they run on the same CPU at the same time.

Похожие вопросы