What is virtualization?
In simple terms, virtualization is a simulated platform or environment on top of a host node, which is quite abstract for an user.
These simulated virtual environment can be an operating systems, or some development environment, etc.
This gives us the ability to efficiently use the hardware resources of the host node.
What is KVM?
KVM stands for Kernel Based Virtualization.
Kernel based virtualization was implemented to get the advantage of hardware assisted virtualization support given by the new generation of Intel and AMD CPU’s.
During initial stages of development of virtualization technology the CPUs where fully emulated by the software which eventually lacked in performance because of absence of direct hardware access.
These days, the CPUs in market supports the virtualization which is the result of the change in their architecture from the earlier stages.
This is also called hardware assisted virtualization.
If you are totally new to virtualization, this is a good place to start, where we’ve explained the three areas of Virtualization, and two types of hypervisors: Introduction to Server Virtualization Technology and Hypervisor Types
The following are various approaches that were followed during the early development stage of the virutalization technology.
- Running the virtual machine on the host systems processor instead of emulating a processor using binary translation technique. It works without modifying the guest operating system.
- Modifying the guest systems operating system to communicate with a Hypervisor which has direct access to the hardware. Xen hypervisor platform is an example of it which implements Para virtualization.
- Modifying the host systems processor so that it could be easy to communicate with hypervisor and thus supporting the virtualization. It removes the need of the binary translation and emulation. It leads to full virtualization rather than para-virtualization.
- Modifying the host systems operating system so that it could support the virtualization. It results in native hypervisors rather than hosted ones.
The kernel based Virtualization leverages the advantages of 3rd and 4th approach mentioned above.
What is a Hypervisor?
A Hypervisor is nothing but a middle layer of program, between the guest operating system and host systems hardware.
It manages the actual hardware for all the connecting guest operating systems.
The hypervisors can be of two types: native or hosted. The hypervisors are also called as VMMs-[Virtual Machine managers]. Please refer the figure below. It represents a bare-metal native hypervisor.
Good examples of hosted hypervisors can be VMware or virtual box software.
If you are new to VMWare, this will help: VMware Virtualization Fundamentals – VMware Server and VMware ESXi
If you are new to Virtualbox, this is a good place to start: How to Install Oracle VM VirtualBox and Create a Virtual Machine
So, as a modern solution for the effective virtualization, kernel based virtual machine (KVM) evolved.
It essentially uses the CPU extensions provided by modern hardware virtualization supporting CPUs, by a module with the kernel of host operating system.
By use of this kernel based virtualization module, the kernel of the host operating systems works as a hypervisor leveraging the features of Linux kernel and the hardware supporting the virtualization.
So to compare KVM with XEN and QEMU, we can say, KVM uses the processor extension for virtualization whereas QEMU works with complete emulation of the CPU on the other hand XEN works as an external hypervisor to the host operating system instead of using kernel for it.
Using KVM we can run multiple virtual machines with any operating system, on a single machine or say the host system. KVM is introduced in Linux Kernel since 2.6.20 stable release. Good Example of KVM is the virtualization solution coming with RPM based Red Hat and Fedora distributions.
Linux KVM Benefits
If you are new to Linux KVM, this will help you to get started: How to Install Linux KVM and Create Guest VM with Examples
The following are some of the features and benefits of Kernel based virtualization.
- With help of KVM module, it manages the performance critical parts of interrupts and timers by kernel based I/O emulation. It gives a capability to set limit on I/O request between virtual machine and host.
- The KVM module allows here emulation for CPU modes not supported by physical processor and the instructions.
- KVM module used is a part of the upstream Linux kernel as it’s added to it for enhancing virtualization.
- KVM module used here provides common interface for both Intel and AMD x86 processors which supports hardware virtualization. For Intel it is known as Intel VMX hardware assist for virtualization and for AMD it is known as AMD SVM hardware assist for virtualization.
- It creates a bare-metal hypervisor out of the kernel. We can say it creates a native hypervisor.
- Leverages the capability of MMU (Memory management unit) in hardware to virtualize the memory with improvement in performance.
- A virtual machine created by it is a standard Linux process, scheduled by its native standard Linux scheduler.
- It supports Intel’s EPT (Extended Page Table) and AMD’s RVI (Rapid virtualization indexing) features for memory virtualization by CPU vendors.
- Its supports all the file system supported by mainstream Linux kernel.
- Improved utilization of resources and access to it by providing flexible storage. It’s very easy to add memory, vCPU, Hard Disk to Linux KVM.
- Supports wide range of guest operating system including windows, UNIX, Solaris and DOS.
- All the features of the Linux like implementation of security using SELinux, wide range of hardware support and supporting Device drivers are inherited to kernel based virtual machines.
- Secure remote management by the API provided by the virtualization modules.
- Enhanced scalability as main stream of Linux kernel can be extended by adding modules to leverage more features.