Page 1 of 1

Is a VM faster when guest and host are similar?

Posted: 4. Apr 2016, 13:47
by Fiksdal
I hope this question isn't too theoretical. I think it's an interesting question.

Is a virtual machine's performance faster when the guest and host OS are similar? If yes, how big, relatively speaking, is the difference? And whether the answer is yes or no, why is it so?

For example:

Same architecture

Will an x86 Windows host virtualize an x86 Android guest faster than it will an ARM Android guest?

Similar OS

In the following two examples, please ignore the fact that Debian is arguably more resource efficient than Windows, and simply focus on relative emulation/virtualization performance.

Will a Windows 10 host virtualize a Windows 7 guest faster than it will a Debian guest? (All are x86.)

Remotely similar OS

Will an OS X host virtualize a Debian guest faster than it will a Windows guest? (All are x86.) (Since OS X and Debian are both UNIX or UNIX-like.)

Finally, what if the guest and host are exactly the same OS? Will a Windows 7 host virtualize another Windows 7 faster than it will virtualize Debian?

Re: Is a VM faster when guest and host are similar?

Posted: 4. Apr 2016, 16:50
by scottgus1
I'm not sure that there is an available answer to your questions, except for one: Virtualbox only does x86, it won't do ARM. So the ARM Android guest won't run at all.

Virtualbox is a hypervisor, not an emulator. Virtualbox provides simulated hardware peripherals and motherboard to the guest OS, but the guest OS uses the host's CPU. There's some context switching stuff to get the guest instructions to run in the midst of the host instructions and end up back in the guest.

My suspicion is that since all the instructions are x86, regardless of Apple/Windows/Linux host or guest, CPU instructions will all run at the same speed when tested on the same host hardware. There may be some more efficient capabilities in one OS family over another to enable better overall virtualization speed, but I don't know for sure myself.

The only way to get decent answers to these scenarios is to try them. Fortunately most of the test software can be used for free, (at least for a certain amount of time in Windows' case) so all it would cost is time to run the tests.

One thing to keep in mind is that the timing routines in benchmark tests don't work reliably in virtual machines. A certain job run in each test, like rendering a video or some such, and a stopwatch and pencil are the best way to test.

It will be interesting to hear what you come up with!

Re: Is a VM faster when guest and host are similar?

Posted: 8. Apr 2016, 09:52
by Fiksdal
scottgus1 wrote:I'm not sure that there is an available answer to your questions, except for one: Virtualbox only does x86, it won't do ARM. So the ARM Android guest won't run at all.

Virtualbox is a hypervisor, not an emulator. Virtualbox provides simulated hardware peripherals and motherboard to the guest OS, but the guest OS uses the host's CPU. There's some context switching stuff to get the guest instructions to run in the midst of the host instructions and end up back in the guest.

My suspicion is that since all the instructions are x86, regardless of Apple/Windows/Linux host or guest, CPU instructions will all run at the same speed when tested on the same host hardware. There may be some more efficient capabilities in one OS family over another to enable better overall virtualization speed, but I don't know for sure myself.

The only way to get decent answers to these scenarios is to try them. Fortunately most of the test software can be used for free, (at least for a certain amount of time in Windows' case) so all it would cost is time to run the tests.

One thing to keep in mind is that the timing routines in benchmark tests don't work reliably in virtual machines. A certain job run in each test, like rendering a video or some such, and a stopwatch and pencil are the best way to test.

It will be interesting to hear what you come up with!
Hi

Thanks for you answer, and sorry for the late reply! Those were some interesting insights. Unfortunately, I won't be able to do any tests myself. I'm on a Hackintosh and virtual machines are not enabled in the BIOS, and I don' have the knowledge to fix it. Also, I'm on a very limited, cellular internet connection where I cannot easily download these OS'es. Anyway, thanks for the input!

Also, does this mean that, if you have abundant RAM and the host OS is not hogging any significant part of the CPU, applications in a VM will run almost as fast as they would if they would if the OS was running directly? Like at least at 90% of the performance?

Re: Is a VM faster when guest and host are similar?

Posted: 8. Apr 2016, 10:54
by mpack
Fiksdal wrote:I'm on a Hackintosh ...
Please make that the last mention of illegal software in this topic.

The type of OS you have installed in your host makes absolutely no difference to how you access your BIOS or what features can be enabled in the BIOS. Check your PC manual for that, or ask the PC manufacturer. Look up the CPU online to make sure it supports VT-x/AMD-v.

Re: Is a VM faster when guest and host are similar?

Posted: 8. Apr 2016, 14:48
by scottgus1
Programs running in a VM will run slower than on physical hardware. My work environment is in a guest, 2 cpus, Windows 7 64-bit, 6GB ram, on a Windows 7 64-bit 32GB Core-I7 6-core host. I run 2D and 3D cad-cam software. The progs run a bit slower than on the other 6GB Win7 I5 & Core-2-quad physical PCs in the office. I can see the difference. But I need the guest environment, so I tolerate the lag. Others may not be able to tolerate, just have to try.