Virtualization Technology-related

Source: Internet
Author: User
Tags switches

The purpose of this article is to understand some of the technical concepts associated with virtualization, Kvm,qemu, hypervisor, Libvirt,virt-manager, Xen, and so on.

Let's start with a holistic understanding of these concepts.

Virt-manager is similar to virtual machine software like Virtual-box,vm-ware, a graphical thing that allows you to create virtual machines and run virtual machines through it in a graphical manner. Libvirt is a driver that is called by Virt-manager. The role of Libvirt is to encapsulate a lower-level KVM or Xen interface. KVM, Xen is actually a kind of hypervisor. The bottom of the hypervisor is hardware, so hypervisor's role is to manage the calling hardware.

Then from the bottom up, gradually understand the physical server or physical server

There's nothing to say, the bottom of virtualization is the hardware.

Hypervisor

The hardware above is hypervisor. Hypervisor is an intermediate software layer running between a physical server and an operating system that allows multiple operating systems and applications to share a set of underlying physical hardware, and therefore can also be seen as a "meta" operating system in a virtual environment that coordinates access to all physical devices and virtual machines on the server. Also called the Virtual machine Monitor. Hypervisor is at the heart of all virtualization technologies. The ability to support multi-workload migrations non-disruptively is the basic function of hypervisor . When the server starts and executes hypervisor, it allocates the appropriate amount of memory, CPU, network, and disk to each virtual machine and loads the guest operating system for all virtual machines.

, the hypervisor below is a physical server running on each virtual machine. It can be understood that hypervisor can be used by software to simulate hardware such as CPU, NIC memory, etc. available to the VM. Currently (04302015) The main hypervisor are VMware VSphere, Microsoft Hyper-V, Citrix XenServer, IBM PowerVM, Red Hat Enterprise virtulization, Huawei FusionSphere, open source KVM, Xen, Virtualbsd, and more.

Libvirt

Above the hypervisor is libvirt. We know that hypervisor is a software middle-tier collectively, with a variety of implementations, such as Kvm,xen. Then the interfaces between the different implementations are certainly different. Then Libvirt's role is to encapsulate these different hypervisor interfaces, providing a unified interface to the outside. Libvirt is an open source library written under the C language of Linux. With this library, you don't have to care what the underlying hypervisor is implemented, just call Libvirt's standard interface to program.

Virt-manager, Virtsh

Libvirt above is the Virt-manager. We know that Libvirt is a driver interface that encapsulates different hypervisor, so Virt-manager is the virtual machine management software that is written using this standard interface. With Virt-manager you can easily create a management virtual machine. It is assumed that no libvirt,virt-manager writers can be laborious, and need to understand the interfaces and mechanisms provided externally by different hypervisor. You can understand Virt-manager as a common Virtual-box or VMware virtual machine management software on Windows. Virsh is the Virt-manager command-line mode.

KVM and Xen

Hypervisor is a software layer, specifically implemented with KVM and Xen. So what's the difference between KVM and Xen?

Xen is a self-customizing hypervisor, which is written from scratch for hardware resource management and scheduling, and life cycle management of virtual machines. KVM Full name is kernel-based Virtual machine, kernel represents the Linux kernel. KVM is a special module, Linux kernel load this module, the Linux kernel can become hypervisor, because the Linux kernel has been able to implement the hardware resource scheduling and management, KVM only implements the work related to virtual machine lifecycle management. The initial version of KVM has only 40,000 lines of code, and the millions of lines of code relative to Xen appear to be very concise. Simply put, Xen is a complete HYPERVISOR,KVM that is a module of Linux. Once the KVM is loaded, you can turn the Linux kernel into hypervisor, because KVM does not have the ability to implement process scheduling, and it needs to use Linux to kernal itself.

KVM and QEMU

We already know that KVM is a kernel module of Linux, then it is a tool that runs in the kernel state. The user has no way to directly control the kernel, so it needs a user-configured toolset. This is the QEMU-KVM. With regard to user space tools, KVM developers have opted for the already formed open source virtualization software QEMU.   QEMU is a powerful virtualization software that can virtualize different CPU architectures. The KVM module running in the kernel State provides an operation interface through the/DEV/KVM character device file.    By providing LIBKVM This operation library, KVM transforms the/DEV/KVM-level IOCTL API into a common function API call to the appropriate adaptation layer for QEMU. For example, virtual a power CPU on a x86 CPU and use it to compile programs that can run on power. KVM uses QEMU's x86-based parts and slightly retrofits Create a user-space tool to control the KVM kernel module QEMU-KVM. So the Linux distribution is divided into kernel parts of the KVM kernel modules and QEMU-KVM tools. This is the relationship between KVM and QEMU.

User state and Kernel state

Kernel State: The CPU can access all the data in memory, including peripherals such as hard drives and network cards. The CPU can also switch itself from one program to another

User state: only limited access to memory, and no access to peripheral devices is allowed. The ability to consume CPU is stripped and CPU resources can be obtained by other programs

Why should we have a user-state and kernel-state

Because of the need to limit the access between different programs, to prevent them from acquiring other programs of memory data, or to obtain peripheral data, and sent to the network, the CPU divided two levels of privilege-the user state and the kernel state

user-State and kernel-state switching

All user programs are run in the user state, but sometimes the program does need to do some kernel-state things, such as reading data from a hard disk, or getting input from the keyboard. And the only thing that can do these things is the operating system, so at this point the program needs the operating system to perform these operations in the name of the program first.

One such mechanism is needed: the user-state program switches to the kernel state, but does not control the instructions executed in the kernel state.

This mechanism is called the system call , the implementation in the CPU is called trap instruction (trap instruction)

Their work flow is as follows:

    1. The user-state program places some data values in registers, or uses parameters to create a stack frame, which indicates the services required by the operating system.
    2. User-state program execution Trap instruction
    3. The CPU switches to the kernel state and jumps to the instructions at the specified location in memory, which are part of the operating system and they are memory protected and cannot be accessed by the user-state program.
    4. These instructions are known as traps or system call processors (handler). They will read the data parameters of the program into memory and execute the service requested by the program
    5. When the system call is complete, the operating system resets the CPU to the user state and returns the result of the system call

Virtualization Technology-related

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.