By now every technical person must have heard of the term virtualization and probably has some general notions of what it can do. My guest is that very fews know how virtualization is achieved. Hopefully this blog will help reveal some of the virtualization mysteries.
In general, the term virtualization refers to the separation of a service request from the underlying physical delivery of that service. For standard x86 systems, there are two virtualization approaches:
- Hosted architecture – runs virtualization layer as an application on top of an OS.
- Hypervisor architecture (bare-metal) – run virtualization layer directly on top of the hardware.
Virtualization layer is the software responsible for hosting and managing all virtual machines on virtual machine monitors (VMM).
A virtual machine is piece of software container that can run its own OS and applications as if were a physical computer and it contains its own virtual CPU, memory, and I/O devices.
The central component of virtualization is the hypervisor. It is a platform that allows multiple OS to run on a host computer at the same time.
There are two types of hypervisor:
- Type 1 (native or bare-metal) – which is used in Hypervisor architecture.
- Type 2 (hosted) – which is used in the hosted architecture.
Each VMM running on the hypervisor implements the virtual machine hardware abstraction and it has to partition and share the CPU, memory and IO devices. Of all the pieces of a system that need to be virtualized, CPU presents the most interesting challenges. There are three techniques:
- Full virtualization using binary translation
- OS assisted virtualization or paravirtualization
- Hardware assisted virtualization
Full virtualization translates kernel code to replace nonvirtualizable instructions with new sequences of instructions that have the intended effect on the virtual hardware.
Paravirtualization involves modifying the OS kernel to replace non-virtualization instructions with hypercalls that communicate directly with the virtualization layer hypervisor.
Hardware assisted virtualization leverages the features that are specifically designed by hardware vendors to aid the VMM to do its job.
In conclusion, virtualization is a complex problem, but it seems like the virtualization pioneers like VMWare and others have figured out how to crack it. There is no doubt about the values that virtualization provides to companies, developers, and our environment. I will blog about its benefits in the post.