This article was firstly published from http://oliveryang.net. The content reuse need include the original link.
Similar with other virtualization technologies,Hyper-V creates a virtual platform for its virtual machine. This article tries to give an overview about the virtual platform provided by Hyper-V, and how Linux OS works in a guest VM. The contents here are limited to Hyper-V, but some basic virtualization concepts might be similar or same with other hypervisors.
1. Virtual Hardware in Hyper-V VMs
Every hypervisor actually defines a clear specification for a virtual hardware inventory provisioned for a guest VM. For Hyper-V, Emulated and synthetic hardware specification for Windows Server 2012 Hyper-V is a such kind of specification. In order to have better understandings of the specification, there are some key concepts need to be clarified.
1.1 Virtualization Types
Today, most of hypervisors provide two virtualization types,
-
If a VM is working under this mode, OS without any virtualization knowledge can run over VM very well, just like running over the bare-metal hardware. With this virtualization type, application running over legacy OS like old Linux, Windows, and DOS could be easily migrated to a VM.
-
When a VM is working under this mode, the OS must have the virtualization knowledge, which means the OS is modified for cooperating with underlying hypervisors. The mechanism that allows guest OS to cooperate with hypervisor is called by a special terminology: hypercall.
At early phases, Para Virtualization usually provides the better performance than Full Virtualization on x86 platform. However, after Intel/AMD introduced the Hardware-assisted Virtualization extensions, such as Intel VT-X and AMD-V, the Full Virtualization VM could perform better than Para Virtualization VM while running the CPU or memory bound workload. Today, the major performance overheads in Full Virtualization VMs are caused by IO bound workloads.
For this reason, most of guest OS uses a Hybrid way to get better performance,
- For major kernel part, it leverages Hardware-assisted Virtualization which is still called Full Virtualization.
- In order to get better IO performance, it supports a set of PV(Para Virtualization) Drivers to optimize the data path.
1.2 Device Types
Hyper-V actually supports 3 type of devices in a guest VM,
Emulated Devices
The devices are emulated by Hyp