If you are a system administrator or a techie trying to understand “what is a hypervisor”, this article is for you. In this article, you will be pretty much clear on the concept of the hypervisor, virtual machine, and the underlying technology virtualization.
Before we proceed, let’s understand a few technical terms associated with hypervisor and virtualization.
Physical machine/Host machine:
It is a physical computer with a CPU, hard-drive, memory, and a network connection. In the context of virtualization, the physical machine is called a host.
Virtual machine/Guest machine:
What you are thinking is right. The virtual machine does not have any physical presence and works on top of the host machine. The working of virtual machines is exactly the same as that of physical machines. End-users may not be able to distinguish between the virtual machine and a physical computer.
Virtualization is a technology through which a physical machine is made capable of sharing its resources with multiple virtual machines. In simple words, virtualization is the process of creating virtual machines on top of a physical machine using the hypervisor software.
And, the virtualization is made possible using a software called hypervisor or virtual machine monitor (VMM).
What is a hypervisor?
A hypervisor or virtual machine monitor (VMM) is special software that runs on the host computer which enables the virtualization feature. The hypervisor is responsible for managing the different types of resources such as CPU, RAM, hard disk allocated to the virtual machines (VMs).
The hypervisor creates the virtualization layer where multiple VMs can be set up.
There is no limit on the number of virtual machines that you can create on a host as long as the host has sufficient RAM, CPU to allocate to each virtual machine.
All the virtual machines share the same hardware such as processor, RAM, hard-drive of the host computer. However, virtual machines run independently.
A host can have multiple virtual machines with different operating systems like Windows, Mac, Linux, and even different types of CPU, storage type, etc.
If you are considering virtualization for your personal use or enterprise use, then you must know the advantages and disadvantages of using virtual machines and different hypervisor types.
Advantages of hypervisor:
You don’t need to buy physical machines, thus saves quite a lot of money.
Since there is only one physical machine with multiple virtual machines, electricity consumption is very less.
- Optimized resource utilization:
The memory can be effectively utilized among the virtual machines. The dynamic memory allocation in type 1 hypervisor enables the VMs to allocate more memory than the host actually has.
- Easy to manage:
The VMs can be managed easily from the host server. In a matter of a few minutes, a virtual machine can be created which is time-consuming in case of physical servers.
Allocating or deallocating resources like RAM, CPU, hard-drive can be done almost instantly on the VMs.
Though the VMs run on a single host, they are independent. As a result, any security compromise on one VM does not affect the other VMs or the host machine.
- Backup and recovery:
The virtual machines are simply files residing on the host machine. The files can be copied and the VM can be made back-up on any physical machine. Just like the restore point concept on Windows, multiple snapshots can be taken for a virtual machine that allows you to restore a copy from a specified snapshot.
So, there is less probability of outage due to file corruption or any unexpected situation in the virtual machine.
- Since the VMs use the shared resources of the host computer, the performance can be compromised if the host machine does not have enough CPU cores, ram, or memory to feed the VMs.
- In case a host machine shuts down or fails due to any reason, all the VMs running on that host fails. However, this situation can be managed with failover in place. As soon as a host machine fails, the failover happens immediately and the environment is migrated to a new server.
Types of hypervisor:
Based on the working technique, there are 2 types of hypervisor.
1. Type 1 hypervisor (Bare Metal / Native):
The Type 1 hypervisor is installed directly on the host computer in place of the conventional operating system. So, they are also called native or bare metal hypervisors. They control the hardware and create the virtualization layer to manage the virtual machines.
Since the type 1 hypervisor is loaded directly on the physical server and there is no operating system like Windows, Linux, Mac, etc, it provides the best performance. This bare metal hypervisor acts as an operating system with a very minimal user interface that is required to only manage the VMs.
The type 1 hypervisor leverages the hardware virtualization. This type of hypervisors is widely used in enterprise-level data centers.
Citrix XenServer, Microsoft Hyper-V, VMware ESXi are some well-known type 1 hypervisors widely used in the corporate sector.
Advantages of type 1 hypervisor:
- Since this type of hypervisor directly runs on the host without a preloaded operating system, the more resource can be shared with the VMs
- The latency time is very low.
- The dynamic allocation of RAM and CPU provides better resource management.
2. Type 2 hypervisor (Hosted):
The type 2 hypervisor also called a hosted hypervisor is a program that runs on top of the conventional operating system. The application provides features to create virtual machines and manage them using software virtualization.
This type of hypervisors are commonly used in IT companies in end user laptops and desktop computers.
Some common examples of type 2 hypervisors are VMware workstation, VMware player, VirtualBox for Windows operating system, and Parallels Desktop for macOS.
Advantages of type 2 hypervisor:
- Using a type 2 hypervisor is cost-effective. Few of the hypervisors like Oracle VirtualBox are free to use and provide decent performance.
- This is a perfect choice for application developers who want to test the application in different environments.
- Creating VMs, Taking snapshots, backup/restore, and other functionalities are very intuitive.
The best part of using a virtual machine is that the VMs from type 1 can be run on type 2 hypervisor and vice versa.
Read also: How to enable virtualization for hypervisor
Type 1 vs Type 2 hypervisor:
Though type 1 and type 2 hypervisors deliver the same result, the difference lies between these hypervisors in the way they operate.
Since the type 1 hypervisor is directly installed on the hardware of the host machine, no doubt the performance is far better than type 2 hypervisor. The performance of type 2 on the other hand is little compromised as the operating system also consumes the host resources.
In type 1 hypervisor, there are more advanced features like an automatic snapshot of the VMs, various failover activities to ensure the applications run uninterruptedly. You can create a new VM or even move a VM from one server to another as part of the failover activity automatically.
A major difference between the type 1 and type 2 hypervisor is in the way they manage the memory allocation.
In type 1 hypervisor for example, if the host has 96 GB of RAM, there can be 3 VMs created with 32 GB RAM each along with another VM with 24GB. Approximately 120GB of RAM can be allocated to all the VMs. This is possible because of the dynamic memory allocation as the VMs may not utilize 32GB of RAM all the time and with the unutilized RAM, another virtual machine can run.
But this is not possible in case of type 2 hypervisor. Once certain RAM is allocated to a VM, it is blocked no matter if the VM consumes it or not. The spare RAM lies unutilized in the guest virtual machines. In the above example, you cannot even have 3 VMs with 32 GB RAM each as the operating system on the host machine needs memory to run.
The primary constraint for most of the companies is the price factor. Based on the various features you need, the type 1 or bare metal hypervisor can have a steep cost graph. On the other hand, the type 2 hypervisor software is comparatively cheap and few free options are available in the market also.
The type 1 should be your first preference if you are looking to host applications for a larger number of users.
But if you are looking to host an application for a comparatively smaller group or on an individual level, type 2 can be a decent option for you.
After all, it is the usage of the virtual machines and your or your organization’s expectation from the hypervisor should be the deciding factor to either go for type 1 or type 2 hypervisor.
I hope you are not clear on what is a hypervisor, its types, and the difference between type 1 and type 2 hypervisors.
Do let us know your thoughts in the comments which will be helpful or other fellow readers.