Introduction to Virtualization
If you managed to reach this blog page hosted in the middle of nowhere, then I am pretty sure you must have used or atleast heard about a "Virtual Machine" at some point in your life. Virtualization is one of the core technologies that drives todays world of Information Technology. The concept of virtualization is not new. Engineers have been trying to nail this technology since 1960s and 1970s, starting with IBM Mainframes, and even today in 2023, it is an area with a lot of effort being invested into.
Why Virtualization
Before talking about what is virtualization, lets understand why there is a need for virtualization. All software systems need hardware resources for computation - CPU, Memory and Disk. Consider your home setup where you have a single desktop that needs to be shared between you and your sister. Either you both could use the same Operating System and the same user and all your data would be transparent to each other. One way to improve privacy would be to use different users, but it still lets your sister wipe your entire drive if she wanted to. Another way would be to install a "Hypervisor" on your desktop and create two Virtual Machines for each person. Each Virtual Machine runs its own operating system, you and you sibling are free to install the OS of your choice. The Hypervisor, is a piece of software that manages the Virtual Machines and ensures privacy by letting each Virtual Machine only access the restricted share of hardware that it is configured to use. Lets say, tomorrow your sister gets her own laptop. Well, it will take less than a few minutes to completely tear down her Virtual Machine and allocate those extra resources to your machine. What if your dad then asks for access to the desktop? Easy, create one VM for him!
From a software engineering standpoint, a lot of applications still do not scale up well(adding CPU, memory, etc.) - they cannot be parallelized. That means, if an application cannot use all the resources at its disposal, a server is going to have a lot of unused compute resources. Having multiple VMs on the hardware running its own OS and processes can make use of hardware more efficiently. So, my point is, virtualization gives us a lot of benefits when managing hardware, IF it is used right. It helps in :
- More efficient use of hardware resources
- Ensuring privacy between different software components running on the same hardware
- Flexible allocation of hardware resources among multiple software systems on the same hardware
- Creating and destroying and recreating machines easily.
- Creating large number of machines with the same configuration.
Hypervisor / Virtual Machine Manager (VMM)
As the name suggests, Hypervisor or Virtual Machine Manager is a piece of software that is responsible for managing and controlling virtual machines. It is responsible for managing hardware resources across VMs, ensuring data and hardware privacy, managing the lifecycle of virtual machines and so on. One important task of the hypervisor is how efficiently it can handle IO and Memory access of all the VMs while maintaining data integrity.
Type 1 and Type 2 Hypervisor
If the hypervisor software runs directly on a hardware, then it is called a type 1 hypervisor. If the hypervisor requires a different Operating System to be installed on the hardware, then it is a type 2 hypervsior. Both types of hypervisors have its own use cases. Systems built specifically for Virtualization usually use Type 1 hypervisors, while Type 2 hypervisors provide some extra configurations. Some examples of Type 1 hypervisors are KVM, Xen and RedHat Enterprise Virtualization (RHEV). Type 2 hypervisors include Oracle VirtualBox, Microsoft Hyper-V, etc.
References
If you are interested to learn more about Virtualization, KVM and QEMU, I highly recommend reading "Mastering KVM Virtualization".
Written by Aswin Unnikrishnan. 17/12/2023