Introduction To Virtualization
At the beginning, before the dawn of time there was emulation.(overly exaggerated)
Emulation, the virtual machine simulates the complete hardware in software. This allows an operating system for one computer architecture to be run on the architecture that the emulator is written for. Sine all operations are run in software, emulation tends to be slower, however can support more platforms since it is hardware independent.
In emulation, the behavior of a complete computer is copied to a software program. The emulation layer talks to an operating system which on its turn talks to the computer hardware. The operating system that you want to install in an emulation layer doesn’t see that it is used in an emulated environemt and therefore you can install it as you are used to install your favourite operating system.
Two popular open source emulators are QEMU (http://fabrice.bellard.free.fr/qemu/)
One of the most important properties of emulation, is that all hardware is emulated, the CPU as well.
This has advantages, such as the fact that you can run an operating system that was developed for another architecture on your architecture. With this advantage however, also comes the most important disadvantage; this same option to virtualize a complete CPU comes with a heavy performance price.
In the next generation, virtualization was taken to a higher level. This means that between the emulation layer that was responsible for interpreting instructions from the virtualized machines and the
Hardware, no host operating system was required between virtual machines and hardware anymore.
Instead the virtual machine monitor, also known as the hypervisor was introduced to run directly on the hardware. Because of this new architecture, virtualization became much more efficient. VMware for
example was very successful with this approach as implemented in VMware ESX.
There are however two different approaches when virtualization is used this way. In the old approach all instructions that were generated by the virtualized machine needed to be translated to the appropriate format for the CPU, which involves a lot of work for the hypervisor.
In the new approach which is used by Xen, there is no translation between the instructions that leave the virtualized machine
and the CPU that executes them.
This can be accomplished in two ways.
Option number one is to use a CPU that understands the unmodified instructions that are generated by the virtualized operating system and interprets them (full virtualization).
Option number two is to modify the operating system so that it generates instructions that are optimized for use in a virtualized environment (para virtualization).
What is virtualization?
- virtualization is a broad term that refers to the abstraction
- of computer resources.
- Server virtualization
- – Hardware – ex: IBM pSeries and zSeries LPARS
- – Software – ex: Vmware, Xen, Solaris Containers, SWsoft
- Virtuozzo, Virtual Box, KVM
- Storage virtulization
- – Hardware – ex: RAID, SAN
- – Software – ex: iSCSI, Veratis Storage Foundation, Software
- Enabled by layer that sits between the OS and
- – OS instances think they are controlling the “real” machine*
- – Virtulization layer mediates access to hardware resources
- – Permits multiple OS instances to coexist on a single server
- – Even incompatible OS’s can share a single server
- – the “layer” is referred to as a Virtual Machine Monitor (VMM)
Full versus Para Virtualization
- Full virtualization is one way of handling virtualization. Using this method, the virtual machine talks to a component called the virtual machine monitor and this virtual machine monitor talks to the hardware platform directly.
- To use full virtualization in a Xen environment, you need a CPU that understands unmodified instructions that are generated by the virtualized operating system. Without this special feature on the CPU’s, it’s not possible to use full virtualization in Xen.
- This is because in the Xen approach not every instruction that is generated by the virtualized operating system is translated to a format that every CPU understands, because this is very resource intensive. Instead, the virtualization feature that is implemented in modern CPU’s helps the virtualized operating system in a way that it can send out unmodified instructions.
- The main advantage of full virtualization, is that an unmodified operating system is installed. This means that virtually every operating system that runs on the same architecture can be virtualized.
- The most efficient approach in virtualization, is para virtualization.
- In para virtualization, the guest operating system uses a specialized API to talk to the virtual machine monitor which is responsible for handling the virtualization requests and putting them to the real hardware.
- Because of this special API, the virtual machine manager doesn’t need to do a resource intensive translation of instructions any more before they can be passed to the hardware.
- Also, when using the paravirtualization API, the virtualized operating system is capable of generating much more efficients instructions.
- A disadvantage however, is that you do need a modified operating system that includes this specific API and for certain operating systems (Windows mainly) this is an important disadvantage because such an API is not available.
Full virtualization on CPUs that have been designed specifically for virtualization. (Examples include the next-generation AMD processors with AMD-V.) A fully virtualized operating system is one that has not been modified specifically to run in a virtual environment, so it is unaware that it is being virtualized. As a result, the hypervisor traps and emulates every I/O and hardware instruction that is deemed privileged by the hypervisor.
Typically, the overhead occurring from these trapping and emulation operations would have a significant impact on performance. However, the AMD processors with AMD-V have been designed specifically for virtualization. The Xen hypervisor interacts with the virtualization extensions in the AMD processors not only to improve performance
and efficiency, but also to provide hardwarebased isolation between these unmodified guest operating systems running on a virtualization server.
The main benefit of full virtualization comes from its ability to host legacy operating systems that have not been paravirtualized. The ability to host these legacy operating systems in a virtualized environment is critical to a data center’s server-consolidation efforts. This feature is mandatory for virtualizing proprietary operating systems, including those from Microsoft*.
- To run full virtualization guests on systems with Hardware-assisted Virtual Machine (HVM), Intel, or AMD platforms, you must check to ensure your CPUs have the capabilities needed to do so.
- To check if you have the CPU flags for Intel support, enter the following:
- grep vmx /proc/cpuinfo
- The output displays:
- flags : fpu tsc msr pae mce cx8 apic mtrr mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
- If a vmx flag appears then you have Intel support.
- To check if you have the CPU flags for AMD support, enter the following:
- grep svm /proc/cpuinfo
- cat /proc/cpuinfo | grep svm
- The output displays:
- flags : fpu tsc msr pae mce cx8 apic mtrr mca cmov pat pse36 clflush dt acpi mmx fxsr sse sse2 ss ht tm syscall nx mmtext fxsr_opt rdtscp lm 3dnowext pni cx16 lahf_lm cmp_legacy svm cr8_legacy
Xen’s unique performance benefits accrue from its use of paravirtualization. With paravirtualization,the operating system running inside of a virtual machine (known as a guest operating system) is modified to run on top of a hypervisor.
virtualized operating system instance is aware that it is running in a virtualized state and has been fine-tuned for optimal performance
in that environment.
Paravirtualization allows the hypervisor to avoid hard-to-virtualize processor instructions by replacing them with procedure calls that
provide that functionality. A paravirtualized operating system loads and runs virtual drivers that are capable of interacting with Xen to access resources on the host virtual server. In other words, it does not require complete emulation of computer devices.