Kvm/qemu Introduction

Source: Internet
Author: User

Reproduced:

http://blog.csdn.net/chdhust/article/details/7557791

VM VMs are based on Linux kernel virtualization and have been integrated into major releases of Linux since linux2.6.20. It is managed using Linux's own scheduler, so its core source code is few compared to Xen. KVM Virtualization requires hardware support (such as Intel VT Technology or AMD V technology) and is hardware-based full virtualization. The early days of Xen were software-based simulations of para-virtualization, and the new version was full virtualization based on hardware support.

QEMU is an analog processor, and now the most used is to combine KVM and QEMU.

To be exact, KVM is a module of the Linux kernel that can be loaded with command modprobe to load a KVM module. After the module is loaded, you can further create the virtual machine from the tool. But the KVM module alone is not enough. Because users cannot directly control the kernel to do things, they must also have a tool running in user space. This user-space tool, the KVM developer chooses the already formed open source virtualization software QEMU. It says QEMU is also a virtualization software. It is characterized by a virtual different CPU. For example, a power CPU can be virtualized on a x86 CPU, and it can be used to compile a CPU that can run on power and use it to compile programs that can run on power. KVM uses a subset of QEMU and is transformed into a user-space tool that can control KVM. So you'll see that the official KVM download has two (QEMU and KVM) three files (KVM modules, qemu tools, and a collection of both). That is, you can upgrade only the KVM module, or you can upgrade only the Qemu tool. This is the relationship between KVM and QEMU.

Such as:

Linux kernel-based virtual Machine (KVM) is a Linux open source virtualization software that is based on hardware virtualization extensions (Intel vt-x and Amd-v) and the modified version of QEMU. The KVM implementation module is two, namely: Kvm.ko is the infrastructure that provides core virtualization; processor-specific modules Kvm-intel.ko and Kvm-amd.ko. It is designed to support complete hardware simulations when multiple, unaltered PC operating systems need to be booted.

A common Linux process has two modes of operation: the kernel and the user. KVM adds a third mode: Customer mode (with its own kernel and user mode). In the KVM model, each virtual machine is a standard process that is managed by the Linux scheduler.

KVM consists of two parts: one is the device driver that manages the virtual hardware, the driver uses the character device/DEV/KVM as the management interface, and the other is the user space component that simulates the PC hardware, which is a slightly modified QEMU process.

Reprint: http://www.scholat.com/vpost.html?pid=7294

The difference between KVM and QEMU in virtualization research

What is the difference between KVM and QEMU, the two well-performing virtual machine software? I'll take a look at the difference between the two code architectures and their implementation platforms. PS: Because I contact the virtual time is not long, the analysis of it may be a lot of places are not in place, I hope that the knowledge of this area of Daniel a lot of corrections! Well, the nonsense is not much to say, please look at the following analysis.

KVM (kernel-based virtual machine) is a full virtualization solution for Linux based on the virtualization extensions (Intel vt or AMD-V) X86 hardware platform, and its basic structure consists of two parts: one is KVM Driver, is a module of the Linux kernel, which is responsible for the creation of virtual machines, the allocation of virtual memory, the reading and writing of virtual CPU registers, the operation of virtual CPUs, and so on; the other part is a slightly modified QEMU, which simulates the user-space components of PC hardware, simulates the I/O device model, and provides access to peripherals.

The KVM basic architecture is shown. Where KVM is added to the standard Linux kernel, it is organized into a standard character device (/DEV/KVM) in Linux. QEMU uses the LIBKVM application interface provided by KVM to create and run virtual machines via the IOCTL system call. The KVM driver makes the entire Linux a virtual machine monitor. And in the original Linux two execution mode (kernel mode and user mode) based on the new addition of customer mode, customer mode has its own kernel mode and user mode. Under the virtual machine run, three modes of division are as follows:

Customer Mode: Executes non-I/O client code, and the virtual machine runs in customer mode.

Kernel mode: The KVM driver works in this mode by implementing a switchover to the customer mode, processing the exit from the client mode due to I/O or other instructions.

User mode: Performs I/O instructions on behalf of the client QEMU runs in this mode.

In the KVM model, each guest OS is a standard Linux process that can be managed using Linux's process management directives.

Its basic working principle: User-mode QEMU uses interface LIBKVM to enter kernel mode via the IOCTL system call. After the KVM driver creates virtual memory and virtual CPUs for the virtual machine, it executes the vmlauch instruction into customer mode and then mounts the guest OS execution. If the guest OS has an external interrupt or an event such as a shadow page table fault, pause the guest OS execution and exit the customer mode for some necessary processing. Then re-enter customer mode and execute the customer code. If an I/O event occurs or a signal arrives in the signal queue, it enters user mode processing.

QEMU (Quick Emulator) is a standalone open-source virtual machine software, it is through pure software to simulate the X86 platform processor to refer to, decode and execute, the virtual client's instruction is not directly executed on the physical platform, it takes advantage of the Micro Code generator module for dynamic translation, Converts the code schema of the client that needs to be impersonated into a host code schema and eventually executes. QEMU virtual machine is a pure software implementation (KVM requires hardware virtualization technology support), so performance is low. However, the advantage is that the virtual machine can not be the same schema as the host. Unlike KVM, QEMU's code contains a complete set of virtual machine implementations, including processor virtualization, memory virtualization, and virtual device simulations used by KVM (such as network cards, video cards, storage controllers, hard drives, and so on).

Kvm/qemu Introduction

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.