Lecture 02 Introduction To Compute Virtualization - Part 1
Lecture 02 Introduction To Compute Virtualization - Part 1
Virtualization – Part 1
Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Foreword
Page 1 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Objectives
Page 2 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Contents
1. Introduction to Virtualization
CPU Virtualization
Memory Virtualization
I/O Virtualization
2. Introduction to KVM
Page 3 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
What’s a Virtual Machine (VM)?
How is a virtual
machine
created?
Page 4 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
What’s a Virtual Machine (VM)?
⚫ Each VM has its own operating system, and functions separately from other VMs,
even if they are located on the same physical host.
⚫ Multiple VMs can share resources from a physical host, including CPU cycles,
network bandwidth and memory.
Page 5 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
What’s Virtualization?
Page 6 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
What’s Virtualization?
⚫ Virtualization converts physical servers into logical folders or files. These folders or
files can be divided into two parts: those that store VM configuration information,
and those that store user data.
Page 7 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
What’s Virtualization?
⚫ Virtualization allows VMs that reside on the same physical server to run
independent OSs. This way, multiple OSs can concurrently run on the same
physical server.
Page 8 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Importance of Virtualization
⚫ Running only one application on a dedicated server could solve these problems
but will easily cause low resource utilization.
⚫ With virtualization, multiple VMs can run on a single physical server, and each VM
can run an independent OS. This improves resource utilization.
Page 9 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
A Brief History of Compute Virtualization
2007 2014
HP launched HP-UX Rocket was launched.
1964 Integrity VMs. 2008
IBM began to Microsoft added
Page 11 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Important Concepts in Compute
Virtualization
Guest OS:
Physical Server Virtual Machine
Operating system running in a virtual machine
Application Application (VM)
Guest Machine:
Host OS Guest OS
Virtual machine created through virtualization
Hypervisor:
Guest Machine
Virtualization software layer, or
Virtual Machine Virtual Machine Monitor (VMM)
Monitor
(Hypervisor)
Host OS:
Host Machine:
Physical machine
Page 12 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Important Concepts in Compute
Virtualization
⚫ A host machine is a physical computer that can run multiple VMs, and an OS
installed and running on the host machine is a host OS.
Page 13 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Important Concepts in Compute
Virtualization
⚫ In a physical architecture (Traditional), a host has only two layers from bottom to
top: hardware (host machine) and host OS. Applications are installed in the host
OS.
Page 14 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Types of Compute Virtualization
Schedule VM queues and return physical hardware processing results to related VMs.
VMM also provisions VMs for running the guest OS. Therefore, VMM also supports
creation and management of virtual environments.
In other words, the hypervisor manages all resources and virtual environments. VMM
can be seen as a complete OS born for virtualization to control all resources (CPUs,
memory, and I/O devices).
Page 15 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Types of Compute Virtualization
App App
VM VM VM App VMM
VMM Host OS
Hardware Hardware
Page 16 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Types of Compute Virtualization
⚫ This type of hypervisor has direct access to hardware resources and does not need to
access the host OS. The hypervisor can be seen as a customized host OS, which
merely functions as VMM and does not run other applications.
⚫ The virtualization products that use Type 1 hypervisors include VMWare ESX Server,
Citrix XenServer, and FusionCompute.
Page 17 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Types of Compute Virtualization
Advantages: VMs can run different types of guest OSs and applications
independent of the host OS.
Page 18 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Types of Compute Virtualization
⚫ Physical resources are managed by the host OS (for example, Windows or Linux).
VMM provides virtualization services and functions as a common application in
the underlying OS (for example, Windows or Linux).
⚫ VMs can be created using VMM to share underlying server resources. VMM
obtains resources by calling the host OS services to virtualize the CPUs, memory,
and I/O devices.
⚫ After a VM is created, VMM usually schedules the VM as a process of the host OS.
Page 19 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Types of Compute Virtualization
Page 20 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Types of Compute Virtualization
Page 21 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Characteristics of Virtualization
Host OS
Partitioned Isolated
Encapsulated Independent
VM VM
Page 22 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Characteristics of Virtualization
⚫ Both Type 1 and Type 2 hypervisors possess the partitioning, isolation, encapsulation, and
hardware independence features.
⚫ Partitioning: indicates the VMM capability of allocating server resources to multiple VMs.
Each VM can run an independent OS (same as or different from the OSs running on other
VMs on the same server) so that multiple applications can coexist on one server.
⚫ Each OS gains access only to its own virtual hardware (including the virtual NIC, virtual
CPUs, and virtual memory) provided by VMM. The partitioning feature solves the following
problems:
Page 23 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Characteristics of Virtualization
⚫ Isolation: Multiple VMs created in a partition are logically isolated from each
other. The isolation feature solves the following problems:
You can specify the minimum and maximum resource usages for each VM to
prevent a VM from exclusively occupying all resources in the system.
Page 24 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Characteristics of Virtualization
Page 25 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Characteristics of Virtualization
Page 26 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Characteristics of Virtualization
⚫ This is similar to editing a Word file by using Office 2007 on computer A that runs
a Windows 7 system and then copying the Word file to computer B that runs a
Windows 10 system. You only need to check whether Office 2007 is installed on
computer B and do not need to check the CPU model or memory size of the
underlying hardware.
Page 27 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Compute Virtualization
CPU virtualization,
memory virtualization,
Page 28 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
CPU Virtualization
Full virtualization Paravirtualization
Application Application
Ring 3 Ring 3
Ring 2 Ring 2
Paravirtualized
Guest OS
Guest OS
Ring 1 Ring 1
Hypervisor Hypervisor
Ring 0 Ring 0
Hardware Hardware
Page 29 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
CPU Virtualization
⚫ Ring 0 has direct access to the hardware. Generally, only the OS and driver have
this privilege.
⚫ Ring3 has the least privilege. All programs have the privilege of Ring 3.
Page 30 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
CPU Virtualization
⚫ For example, if a program needs to enable a camera, the program must request a
Ring 0 driver to do that on its behalf. Otherwise, the operation will be rejected.
Page 31 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
CPU Virtualization
Page 32 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
CPU Virtualization
⚫ Full virtualization:
⚫ All OS requests sent by VMs are forwarded to VMM, and VMM performs binary translation
on the requests. When VMM detects privileged or sensitive instructions, the requests are
trapped into VMM for emulation.
⚫ Then, the requests are scheduled to the CPU privilege level for execution. When VMM
detects program instructions, the instructions are executed at the CPU non-privilege level.
⚫ This technique is called full virtualization because all request instructions sent by VMs
need to be filtered.
Page 33 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
CPU Virtualization
Modifying the guest OS binary code during running causes large performance
loss and increases the VMM development complexity.
Page 34 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
CPU Virtualization
⚫ Paravirtualization:
Page 35 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
CPU Virtualization
⚫ Multiple types of guest OSs can run at the same time. Paravirtualization delivers
performance similar to that of the original non-virtualized system.
⚫ The host OS can be modified only for open-source systems, such as Linux. Non-
open-source systems, such as Windows, do not support paravirtualization. In
addition, the modified guest OS has poor portability.
Page 36 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Memory Virtualization
VM memory
Host
memory
Page 37 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Memory Virtualization
⚫ Memory virtualization creates a new layer of address spaces, that is, the address
spaces of VMs. The VMs are made to believe that they run in a real physical
address space when in fact their access requests are relayed by VMM.
⚫ VMM stores the mapping between guest machine address spaces and physical
machine address spaces.
Page 38 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Memory Virtualization
⚫ The following direct address translation path must be supported so that multiple VMs can
run a physical host: VA (virtual memory) → PA (physical memory) → MA (machine memory).
⚫ The VM OS controls the mapping from the virtual address to the physical address of the
customer memory (VA → PA).
⚫ However, the VM OS cannot directly access the machine memory. Therefore, the
hypervisor needs to map the physical memory to the machine memory (PA → MA).
Page 39 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Quiz
A. Guest OS
B. VMM
C. Hypervisor
D. Host OS
B. FALSE
Page 40 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Recommendations
Page 41 Copyright © 2019 Huawei Technologies Co., Ltd. All rights reserved.
Thank You
www.huawei.com