It’s time to move on! It’s time to understand what is virtualization and why you need it. I know, it’s complicated to feel comfortable with something you don’t know, with something so complicated. But here you are reading my blog post and that means that you are considering the technology, that you care about understanding the definitions, the benefits and the technology behind virtualization.
What is virtualization
When people talk about virtualization they usually mean hardware virtualization. Although it is not the only form of virtualization, it’s the most widespread. In hardware virtualization, either hosted or hypervisor (bare metal), a number of individual O/S instances encapsulated as virtual machines to run on a single computer, dynamically partitioning and sharing available physical resources as CPU, storage and I/O devices.
Most users are familiar with products like VMWare workstation, MS Virtual PC and windows XP emulation mode which are a form of platform virtualization with hosted architecture. In hosted architecture the virtualization layer is installed as an application on top of an operating system (like windows, unix, linux, etc). This configuration has great flexibility in terms of hardware compatibility because of the presence of the host operating system.
In a hypervisor architecture the virtualization layer is installed directly to the hardware platform thus it is more reliable, scalable and robust. Because of the absence of the host operating system, hypervisor architecture works on limited certified hardware. Products with hypervisor architecture include VMware ESX, VSphere, Microsoft Hyper-V, Sun xVM, wind river, etc.
In both methods virtual machines are abstracted from the underlying hardware; in simple terms the guest O/S does not understand that it runs in a virtual environment. This achieved by the virtualization layer which is responsible for the abstraction, sharing and partitioning of the CPU, memory and I/O devices.
Comparison of virtualization methods
Hardware virtualization was a great challenge to achieve because operating systems are designed to directly interact with bare-metal hardware. Virtualization vendors had to develop a strategy in which the O/S could be hosted in a virtual environment. And they came up with 3 different methods:
In binary translation the virtualization layer sits at CPU privilege level 0 (most privileged). The Guest O/S system were supposed to run on level 0, but since virtual layer occupies that level, it moves guest O/S execution at privilege level 1 and leaves user applications at level 3 as it supposed to be. The non-virtualizable kernel code of the guest O/S is translated by virtual layer into new sequences of instructions that have the intended effect on virtual hardware, while user level code is directly executed on the CPU for high performance. The benefit of this approach is that the O/S is fully abstracted from the underlying hardware thus it doesn’t require any modification.
In hardware assisted virtualization the virtual layer sits in a new root mode privilege level under level 0. Guest O/S privileged and sensitive calls are set to auto trap to the hypervisor while user request are executed directly to the CPU for high performance. Hardware assisted virtualization requires a compatible CPU like intel VT-x and AMD’s AMD-V to work. This technique is not performing as expected because of the high overhead between guest O/S-to-hypervisor transition. On the other side hardware assisted virtualization is the future and we are expecting to see improved performance in next generation releases. At this moment this technique is utilized in specific cases by vendors like VMware such as for 64-bit guest support on Intel Processors. O/S is still fully abstracted from the underlying hardware thus it doesn’t require any modification.
In paravirtualization the Guest O/S kernel is modified to provide a special API that can be used by the virtual layer to translate non-virtualizable instructions with hypercalls. Virtualization layer interacts directly with guest O/S thus its lower virtualization overhead and better performance, though it can vary depending on the workload. Since paravirtualization requires kernel modification it is not suited for O/S like MS windows which kernel cannot be modified. Also in production environments deep kernel modification is a matter of question since it introduces significant support and maintability issues.
Paravirtualization is used in many cases by vendors in conjunction with binary or hardware assisted technique to provide better performance. Example of this are VMtools which are a set of drivers and tools that allow virtual layer to interact with Guest O/S for better performance and manageability but not in the CPU level.