≡ Menu

Intro to Linux KVM (Kernel Based Virtualization) and its Benefits

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.

Hypervisor Type 1

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

KVM Evolution

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.

  1. 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.
  2. The KVM module allows here emulation for CPU modes not supported by physical processor and the instructions.
  3. KVM module used is a part of the upstream Linux kernel as it’s added to it for enhancing virtualization.
  4. 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.
  5. It creates a bare-metal hypervisor out of the kernel. We can say it creates a native hypervisor.
  6. Leverages the capability of MMU (Memory management unit) in hardware to virtualize the memory with improvement in performance.
  7. A virtual machine created by it is a standard Linux process, scheduled by its native standard Linux scheduler.
  8. It supports Intel’s EPT (Extended Page Table) and AMD’s RVI (Rapid virtualization indexing) features for memory virtualization by CPU vendors.
  9. Its supports all the file system supported by mainstream Linux kernel.
  10. 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.
  11. Supports wide range of guest operating system including windows, UNIX, Solaris and DOS.
  12. 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.
  13. Secure remote management by the API provided by the virtualization modules.
  14. Enhanced scalability as main stream of Linux kernel can be extended by adding modules to leverage more features.
Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • Lev Lafayette October 4, 2016, 11:49 pm

    > KVM stands for Kernel Based Virtualization.<

    Not quite. Like most things, the acronym gives a good hint of the meaning.

    It's Kernel-based Virtual Machine, KVM.

    "KVM (for Kernel-based Virtual Machine) is a full virtualization solution for Linux on x86 hardware containing virtualization extensions (Intel VT or AMD-V). "