Exploring Linux kernel virtual machines-learning the KVM architecture and its advantages

Source: Internet
Author: User
Article title: Exploring Linux kernel virtual machines-learning the KVM architecture and its advantages. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Linux has both good flexibility and excellent virtualization. However, with the emergence of kernel virtual machines (KVM), the prospect of Linux virtualization has changed recently. KVM is the first virtualization solution that forms part of mainstream Linux kernel (V2.6.20. KVM supports virtualization of Linux customers' operating systems-or even virtualization of their hardware on virtualization-sensitive Windows systems. Understand the Linux KVM architecture and understand why its close integration with the kernel has changed the way you use Linux.

Introduction

The concept of virtualization has long existed. Simply put, virtualization is the process of using certain programs and making them look similar to other programs. Applying this concept to computer systems allows different users to see different single systems (for example, a computer can run both Linux and Microsoft Windows ). This is usually called full virtualization ).

Virtualization can also use a more complex format, where a single computer looks to have multiple architectures (for one user, it is a standard x86 platform; for another user, it is an IBM Power PC platform ). This virtualization form is often called hardware simulation.

Finally, a simpler type of virtualization is operating system virtualization. one computer can run multiple operating systems of the same type. This virtualization can isolate multiple servers in one operating system (which means all operating systems of the same type and version must be used ).

Para-virtualization)

The two most common virtualization methods are full virtualization and quasi-virtualization. With full virtualization, there is a layer between the virtualized operating system and the hardware to determine access. This layer is called a system manager or virtual machine monitor (VMM ). Quasi-virtualization is similar to this, but system management programs operate in a more collaborative manner. This is because every customer's operating system understands that he is running in virtualization mode. Therefore, every system works with the system management program to achieve virtualization of underlying hardware.

Examples of full virtualization include commercial virtualization solution VMware and the IBM System z9 Virtual Machine (z/VM) operating System used on commercial IBM zSeries computers. Quasi-virtualization examples include Xen and User-Mode-Linux (UML ). KVM is also considered a full virtualization solution, but we will discuss this issue later.

How virtualization works

First, we will briefly introduce the virtualization technology and its elements. The bottom of the virtualization solution is the machine for virtualization. This machine may directly support virtualization, or it may not directly support virtualization. Therefore, you need to support the system management program layer. System management programs, or VMM, can be seen as abstraction of platform hardware and operating systems. In some cases, this system administrator is an operating system. In this case, it is called a host operating system, as shown in Figure 1.


Figure 1. layered abstraction of virtualization

The system hypervisor is a client operating system, also known as a virtual machine (VM ). These VMs are isolated from each other, and the underlying hardware platform is regarded as its own. But in fact, it is the illusion that system management programs create for them.

Currently, the problem with virtualization solutions is that not all hardware can support virtualization well. Older x86 processors produce different results for specific commands based on the execution scope. This creates a problem because the system administrator program can only be executed within one of the most protected ranges. For this reason, virtualization solutions such as VMWare scan the code to be executed in advance to replace these commands with some trap commands ), in this way, the system administrator can process them correctly. Xen supports a collaborative virtualization method that does not need to be modified because the client knows that it is virtualizing and has been modified. KVM simply ignores this issue. if you want to virtualize it, you must run it on the updated hardware.

At the beginning, I thought this was inconvenient. However, considering that newer machines currently listed can support virtualization (such as Intel VT and AMD SVM), it may not take long, this will become a standard method, rather than a few exceptions.

KVM system management program

Considering that the development of virtualization technology is not long, KVM is actually a relatively new technology. Currently, multiple open-source technologies are available, such as Xen, Bochs, UML, Linux-VServer, and coLinux. However, KVM is widely used. In addition, KVM is no longer just a full virtualization solution, but will become part of a larger solution.

KVM is used to convert the Linux kernel into a system administrator by simply loading the kernel module. This kernel module exports a device named/dev/kvm, which can enable the kernel customer mode (except the traditional kernel mode and user mode ). With the/dev/kvm device, the VM makes its address space independent from the address space of the kernel or any other VM running. Devices in the device tree (/dev) are common to all user space processes. However, each process that opens/dev/kvm sees different mappings (to support isolation between VMs ).

KVM then converts the Linux kernel into a system management program (when the kvm kernel module is installed ). Because the standard Linux kernel is a system management program, it will benefit a lot from the modifications to the standard kernel (memory support, scheduling program, etc ). Optimizing these Linux components (such as the new O (1) scheduler in the 2.6 kernel) can benefit both the system management program (host operating system) and the Linux client operating system. But KVM is not the first program to do this. UML has long ago converted the Linux kernel into a system management program. Using the kernel as a system management program, you can start other operating systems, such as another Linux kernel or Windows system.

[1] [2] [3] Next page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.