Why Use Cloud:
The capacity of data centre is stable. but the demands of business is complicated, wavy and unpredictable.
Two Key Advantages:
- Dynamic (on-demand) resource scaling
- Pricing : “Pay by use”
Virtualization:
Software define hardware resource. It is the abstraction of resources which convert from real hardware resource.
Hypervisor;VMM:
A virtualization platform that allows multiple operating systems to run on one machine at the same time.
Type:
- Xen, Citrix Xen
- KVM, included in Linux Kernel
- Vmware, Vmware ESX
- Hyper-V
Xen, Citrix Xen and Vmware ESX run directly on top of the hardware. Others run on the another operation system.
Rings:
- Ring0: Kernel mode(OS)
- Ring3: User mode(user process)
- VMM runs on Ring0
- GuestOS runs on Ring1, pretend on Ring0
3 CPU Virtualization tech:
1. Full Virtualization
- Without Guest OS modifications,The guest OS is not aware it is being virtualized.
- Using Binary Traslation(Qemu)
- Apps request directly execute with hardware while OS request need binary traslation by VMM(ring0)
全虚拟化的运行速度要快于硬件模拟, 但是性能方面不如裸机, 因为Hypervisor需要占用一些资源. 全虚拟化最大的优点是操作系统没有经过任何修改. 它的唯一限制是操作系统必须能够支持底层硬件
半虚拟化(Paravirtualization)是另一种类似于全虚拟化的热门技术. 它使用Hypervisor(虚拟机管理程序)分享存取底层的硬件, 但是它的客户操作系统集成了虚拟化方面的代码. 该方法无需重新编译或引起陷阱, 因为操作系统自身能够与虚拟进程进行很好的协作. Xen是一款虚拟化软件,支持半虚拟化和完全虚拟化。它在不支持VT技术的cpu上也能使用,但是只能以半虚拟化模式运行。
2. Para Virtualization
- Xen runs in Ring0, modified Guest Kernel runs in Ring1 and Guest Applications run unmodified in Ring3
- For the any privileged operations(shut down), CPU in ring0 will call to the hypervisor(known as hypercalls).
3. Hardware Assisted Virtualization
intel VT-x and AMD-V allows the VMM runs below ring0, while Guest OS in ring0.
Virtual Machine Extension (VMX) operations
- More-privileged mode (VMX root)@Ring -1
- Less-privileged mode (VMX non-root)
- root->VM entry->non-root
- non-root->VM exit->root
- VM Entry : load guest state from the guest-state area.
- VM Exit : save guest state to the guest-state area and then load VMM state from the host-state area.