Compute virtualization
introduce
Abstract the physical resources (CPU, memory, IO peripherals) on the physical host into excessive and equal amounts of logical resources (virtual CPU, virtual memory, virtual IO devices) through the virtualization layer, and then recombine them to form a new virtual host .
Method to realize
Full virtualization
Relying on virtualization engine
paravirtualization
Achieved by modifying the virtual machine kernel engine
Hardware-assisted virtualization
Realized with hardware assistance
object
CPU
User mode and kernel mode
Resource management, security
Deploy virtualized user mode and kernel mode
problem found
The instruction sets of virtual machines (linux, Windows, etc.) of different operating systems are different. Some virtual machine request instructions cannot be recognized by the physical machine operating system kernel.
In fact, what CPU virtualization does is "translation".
Solve the problem
Software Translation Method (Full Virtualization)
- Description:
Design a translator, that is, VMM. The virtual machine implements instruction set translation through the VMM program running in the kernel state, and then calls it.
- shortcoming
Software Translation Method (Paravirtualization)
- Note:
The instruction set is not translated through the VMM, but modified within the Guest OS, and then directly accesses the physical machine core and calls peripherals.
- shortcoming
Hardware translation method (hardware-assisted virtualization)
- Description:
Implement instruction set translation through external hardware modules, and then call peripherals to improve computing performance.
- shortcoming
Memory
Traditional physical machine memory mechanism
Deploy virtualized memory access mechanism
problem found
After virtualization, the conversion process becomes:
virtual machine process memory logical address - "virtual machine physical memory address;
virtual machine physical memory address (physical machine process logical address) -" physical machine physical memory address
Solve the problem
One-level mapping table method (full virtualization)
Create a new software mapping table, and the VMM takes the initiative to communicate with the virtual machine to realize direct mapping of the process logical address in the virtual machine and the physical address of the physical machine to achieve efficient conversion.
One-level mapping table method (paravirtualization)
Modify the virtual machine kernel so that the virtual machine can directly access the physical machine mapping table to achieve efficient conversion.
Two-tier mapping table method (hardware-assisted virtualization)
Address translation within the virtual machine improves translation efficiency through hardware support. Major manufacturers have successively launched hardware-assisted memory virtualization technologies, such as Intel's EPT (Extended Page Table) and AMD's NPT (Nested Page Table).
IO device
Full virtualization
VMM simulates IO devices and has nothing to do with hardware. It can simulate any hardware device; that is, simulating IO devices in a virtual machine requires scheduling IO devices in a physical machine, which results in low performance.
Paravirtualization (not overview)
Refining VMM work to achieve pipeline operations.
Backend: VMM is only responsible for scheduling IO resources in physical machines.
Frontend: The simulation of IO devices in virtual machines is handled by specialized drivers.
Hardware-assisted virtualization
The IO device itself supports virtualization, does not require VMM implementation, and has high performance.
Note: There is a pass-through device in virtualization, which is only used by a certain VM (exclusive, such as VMWARE's pass-through device)
Implementation technology (virtualization engine)
VMWare
Xen
hyper-v
KVM
qume
resource planning
CPU virtualization
- official
- Loss formula not considered (estimate)
- Consider the loss formula
CPU over-allocation planning suggestions
- Suggestion one
- Suggestion two
memory virtualization
official