What is KVM?kernel

28/12/2020
KVM

Virtualization refers to the creation of a simulated computing resource that mimics the behavior of the corresponding real or physical resource. Many types of resources can be virtualized, from software to individual hardware devices to complete hardware platforms. This post focuses on virtual machines which comprise devices like CPU, memory, network card, disk, graphics adapter, and the operating system. Software which creates and runs virtual machines is called a hypervisor. Below, we will discuss the features of a hypervisor named KVM.

Benefits of virtualization

In the past, being homogeneous was the modus operandi in data centers, development houses, and at home. Practically, all machines would run the same release of a single operating system, whether it be Linux, Windows, or FreeBSD. Times have changed.

Today, we’d expect different OSes such as Linux and Windows, and even different versions of an OS (e.g., Windows XP and 10) to co-locate in the same computer environment. Without virtual machines, multiple physical machines must be deployed and maintained, in order to run applications on multiple operating platforms. Virtualization powers the running of multiple virtual machines, each potentially with a different OS, on a single physical machine.

The advantages of virtual machines over physical machines include:

  1. More efficient use of computer resources.
    The price of hardware keeps trending down while their processing power keeps going up. Under this reality, many big powerful machines today tend to be under-utilized, as measured by idle CPU cycles, unused memory, etc. The consolidation of virtual machines onto fewer physical machines results in less physical resources and therefore better efficiency.
  1. Improved I.T. responsiveness and productivity.
    Provisioning new physical hardware entails a long acquisition wait period followed by a lengthy installation and deployment period after its arrival. In contrast, provisioning virtual machines can be automated and made available in minutes rather than days or even weeks that traditional machine acquisition sometimes takes.
  1. Cost saving.
    Big data centers will save money due to lower operating costs. The saving comes in the form of reduced energy bills as a result of lower cooling and power requirements.

Introducing KVM

Kernel-based Virtual Machine, or KVM in short, is a free and open-source hypervisor solution. It competes in a mature industry with open-source alternatives such as Xen, VirtualBox, as well as proprietary products like VMware vSphere, Citrix XenServer, Microsoft Hyper-V.

Before 2005, hypervisor solutions at the time, such as Xen and VirtualBox, were all software-based. The x86 architecture simply did not have provision for supporting virtualization.  In 2005, the introduction of the instruction set extensions Intel VT and AMD-V permanently changed the virtualization landscape. KVM released its first version in 2006, and was one of the first hypervisors to take advantage of the new hardware provision to optimize virtualization performance.

You can install KVM on any 32-bit or 64-bit x86 computer, the ‘host machine’ in hypervisory lingo, that supports the Intel VT or AMD-V extension. Today, modern hypervisors typically support hybrid virtualization: hardware-assisted when possible and a failover to software-only for older chipsets.

KVM is categorized as a type-2 hypervisor, meaning that it runs within a host operating system. As its name suggests, KVM is kernel based, and to be more precise, it is the Linux kernel. So, it is not surprising that KVM supports only Linux as its host OS. (KVM was subsequently ported to FreeBSD.)  If you want an open-source multi-platform type-2 hypervisor, VirtualBox is a good candidate. VirtualBox can run natively on Windows, Linux, Mac OS X, and Solaris.

Xen, in contrast, is a type-1 hypervisor, also known as bare-metal hypervisor, which runs directly as firmware on the host machine. The advantage of type-1 over type-2 is the efficiency gained due to the hypervisor running directly on the underlying hardware. The disadvantage is that a type-1 hypervisor may not support as wide a range of host devices as the host operating system of a type-2 hypervisor.

While hypervisors may differ in whether they require a host OS and which ones, they are very similar with respect to which guest OSes that they support, ie, the OS that a virtual machine can run. KVM supports the virtualization of the following guest OSes:

  • Linux distributions including Debian, Ubuntu, Centos, Fedora, RedHat Enterprise Linux
  • BSD such as OpenBSD, FreeBSD, NetBSD
  • Solaris
  • Windows

KVM is able to run unmodified guest OS images. This feature is known as full virtualization, as opposed to para-virtualization where the guest OS is modified for special handling of operations  that are substantially more difficult to run on the virtual machine than on the host machine.


How KVM works

KVM consists of 2 technology components: kernel and user-space. The kernel component consists of 2 loadable kernel modules: kvm.ko, and either kvm-intel.ko or kvm-amd.ko. The kvm.ko module provides core architecture-independent virtualization processing. The kvm-intel.ko and kvm-amd.ko modules correspond to Intel and AMD processor-specific modules. These modules were merged into the Linux kernel as of kernel version 2.6.20.

The tight integration of KVM with the Linux kernel has its advantages. KVM is able to delegate to Linux to do the system grunt work, while it focuses on handling the new virtualization instructions exposed by the hardware. KVM also benefits by inheriting from any continuing system improvement from upstream in the larger Linux community.

Important that the kernel modules are, they do not emulate virtual machine hardware that the guest OS runs on. That job belongs in user-space. KVM uses QEMU, which runs in the user-space, to build the virtual machines that interact with the guest OSes.  Each virtual machine is simply a regular Linux process. One big benefit is that you can use familiar Linux commands such as top and kill to monitor and manage virtual machines.


Summary & conclusion

KVM is an excellent open-source solution for full virtualization on the Linux host platform. After 10+ years of active development, KVM has become the de facto standard machine-level virtualization tool in many Linux distributions.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Installing KVM/QEMU on CentOS 8 for Virtualization

In this article, I am going to show you how to install KVM/QEMU on CentOS 8 and how to connect to it remotely using Virtual...
29/12/2020

[KVM] Hướng dẫn sử dụng WebVirtCloud

Sau bài cài đặt, mình đã dành vài ngày để thử nghiệm các tính năng và cách sử dụng của WebVirtCloud....
30/12/2020

[KVM][CentOS8] Hướng dẫn cài đăt KVM trên CentOS 8.

CentOS 8 mới được ra mắt ngày 25/09/2019 có nhiều thay đổi và các tính năng mới. Bạn đọc có...
30/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Mua proxy v4 chạy socks5 để chơi game an toàn, tốc độ cao ở đâu?
18/05/2024

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời
18/05/2024

Thuê mua proxy Viettel ở đâu uy tín, chất lượng và giá tốt? 
14/05/2024

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024