Книга: Fedora™ Unleashed, 2008 edition
Virtualization Versus Paravirtualization
Virtualization Versus Paravirtualization
The method in which operating systems are kept isolated is quite simple: They really do each get a virtual machine. When you create a new VM, it is allocated a chunk of RAM all to itself, and lives completely self-contained from the outside world. VMware even has a virtual BIOS to complete the illusion. If your VM wants to communicate to other VMs on the same computer, it has to do so over a TCP/IP network connection, just like any other machine. In fact, when you install an operating system on a virtual machine, it cannot even tell that it is a virtual machine because it looks identical to raw hardware.
The problem with this type of virtualization is that it is very slow. For example, the VM has to access hardware frequently (to save files, show a display, and so on), but of course it cannot access the hardware directly because doing so would interfere with other VMs. Instead, its requests have to be translated and rerouted to the host operating system (OS), where they are handled. Similarly, if the VM tries to execute any special CPU instructions that would reveal that the VM is actually a virtual machine, the host OS has to stop those instructions and fake the answer so that the VM is not any wiser (a technique known as binary patching).
The solution is to move from virtualization to paravirtualization — the technique that Xen uses. Linux is open source, so the Xen developers modified the Linux source code so that Linux becomes aware of its existence as a virtual machine. When the virtual Linux needs access to the hardware, it just asks Xen for permission. The difference is huge: You can expect a normal VM to run at about 50% of the speed of a native machine, whereas a Xen virtual machine can run up to about 95%, simply by removing the need for binary patching and other virtual hacks.
The downside to Xen is that the source code has to be patched, which rules out closed-source operating systems. VMware runs Windows XP on Linux out of the box, but Xen cannot. That said, the new chips from Intel and AMD include virtualization on hardware, which enables Xen to run unmodified Windows at full speed on top of Linux. Without this technology, Xen can use only a modified, open source distribution, such as Linux, NetBSD, or FreeBSD.
- Why Virtualization Is a Smart Idea
- Private versus Shared Assemblies
- Choosing a Database: MySQL Versus PostgreSQL
- 1.3.1. Free Versus Freedom
- 2.1.1. BIOS Versus Bootloader
- 7.2.2. Flash Versus RAM
- 2.3.4. Blocking versus Nonblocking Primitives
- 2.3.5. Buffered versus Unbuffered Primitives
- 2.3.6. Reliable versus Unreliable Primitives
- 4.5.3. Synchronous versus Asynchronous Systems
- PAP Versus CHAP
- NIS Versus NIS+