How to understand KVM (KERNEL VIRTUAL MACHINE)

How To Understand KVM (KERNEL VIRTUAL MACHINE)

KVM (for Kernel-based Virtual Machine) is a full virtualization solution for Linux on x86 hardware containing virtualization extensions (Intel VT or AMD-V). It consists of a loadable kernel module, KVM.ko, that provides the core virtualization infrastructure and a processor specific module, KVM-intel.ko or KVM-amd.ko.

Using KVM, one can run multiple virtual machines running unmodified Linux or Windows images. Each virtual machine has private virtualized hardware: a network card, disk, graphics adapter, etc.

KVM is open source software. The kernel component of KVM is included in mainline Linux, as of 2.6.20. The userspace component of KVM is included in mainline QEMU, as of 1.3.

 

How KVM work?

KVM converts Linux into a type-1 (bare-metal) hypervisor. All hypervisors need some operating system-level components—such as a memory manager, process scheduler, input/output (I/O) stack, device drivers, security manager, a network stack, and more—to run VMs. KVM has all these components because it’s part of the Linux kernel. Every VM is implemented as a regular Linux process, scheduled by the standard Linux scheduler, with dedicated virtual hardware like a network card, graphics adapter, CPU(s), memory, and disks.

 

Implementing KVM

Needf to run a version of Linux that was released after 2007 and it needs to be installed on x86 hardware that supports virtualization capabilities. If both of those boxes are checked, then all you have to do is load 2 existing modules (a host kernel module and a processor-specific module), an emulator, and any drivers that will help you run additional systems.

 

KVM features

KVM is part of Linux. Linux is part of KVM. Everything Linux has, KVM has too. But there are specific features that make KVM an enterprise’s preferred hypervisor.

Security

KVM uses a combination of security-enhanced Linux (SELinux) and secure virtualization (sVirt) for enhanced VM security and isolation.

Storage

KVM is able to use any storage supported by Linux, including some local disks and network-attached storage (NAS)

Hardware support

KVM can use a wide variety of certified Linux-supported hardware platforms. Because hardware vendors regularly contribute to kernel development, the latest hardware features are often rapidly adopted in the Linux kernel.

Memory management

KVM inherits the memory management features of Linux, including non-uniform memory access and kernel same-page merging.

Live migration

KVM supports live migration, which is the ability to move a running VM between physical hosts with no service interruption.

Performance and scalability

KVM inherits the performance of Linux, scaling to match demand load if the number of guest machines and requests increases.

Scheduling and resource control

In the KVM model, a VM is a Linux process, scheduled and managed by the kernel. The Linux scheduler allows fine-grained control of the resources allocated to a Linux process and guarantees a quality of service for a particular process.

Lower latency and higher prioritization

The Linux kernel features real-time extensions that allow VM-based apps to run at lower latency with better prioritization (compared to bare metal).