Paravirtualization is a type of virtualization in which a guest operating system (OS) is recompiled, installed inside a virtual machine (VM), and operated on top of a hypervisor program running on the host OS. In comparison to traditional full virtualization, paravirtualization can cut down on overhead and improve system performance.
Paravirtualization, full virtualization, and partial virtualization are three types of virtualization, a term that refers to the creation of a virtual rather than actual (physical) version of a resource such as an operating system (OS), server, desktop, storage device, or network.
Virtualization carves a resource into multiple execution environments through application of technologies that can include emulation, machine simulation, hardware and software partitioning.
In enterprises, virtualization is often used for purposes such as:
- Running multiple OSes on a computer simultaneously.
- Segmenting large systems into smaller parts for more efficient use of physical hardware.
- Isolating programs running inside a virtual machine (VM) to keep them safe from processes taking place in another VM on the same host. If one VM goes down, for example, other VMs can stay up and running.
A VM is the equivalent of a computer system running on top of another system. VMs are created and operated through software programs known as hypervisors.
Hypervisors are classified into two categories. Type 1, or "bare metal" hypervisors, act rather like OSes and operate guest VMs directly on a system's hardware. Type 2, or "hosted" hypervisors, behave more like traditional software applications.
What is Paravirtualization?
- Paravirtualization was developed to provide better performance than software-assisted full virtualization by permitting the OS to recognize the presence of the hypervisor and communicate with the hypervisor directly. Paravirtualization also makes sure that a guest OS is recompiled before being installed in a VM. Generally speaking, however, paravirtualization requires guest OSes to be modified so as to implement an API for exchanging commands sent from the hypervisor to the server.
- Xen/Xenserver is probably the best known hypervisor software for paravirtualization. With version 3.0, Xen also began to support hardware-assisted full virtualization on enabled Intel and AMD processors, for operability with OS which cannot be modified, such as Windows. With version 4.7, Xen introduced live patching. In version 4.10, Xen added initial support for PVH (Paravirtualization Hardware), increasing that support in the 4.11 update, released in mid-2018.
- PVH is an effort to combine the best of paravirtualization with HVM (Hardware Virtual Machine) approaches. Where PV (paravirtualization) virtualizes some elements of a hardware system, including network and disk interfaces, native/HVM virtualization follows a different course and offers a limited form of hardware emulation for virtualized access to system hardware interfaces. HVM interfaces are now available for most system hardware.
- Wide support: Paravirtualization is supported by IBM LPAR, Oracle VM for SPARC (LDOM), and Oracle VM for X86 (ODM).
Unlike full virtualization, paravirtualization does not need to emulate hardware for VMs. Instead, it provisions an interface to VMs which is somewhat similar to the underlying hardware. Most modern OS, including Linux and Windows, ship with support for one or more paravirtualization interfaces.
VirtualBox Paravirtualization Interface
VirtualBox enables the exposure of a paravirtualization interface for more accurate and efficient execution of software within a VM. Three paravirtualization interfaces are provided:
Minimal (mandatory for running Apple Mac OS X guests); KVM (recommended for Linux guests); and Hyper-V (recommended for Windows guests).
What is Full Virtualization?
Full virtualization allows an unmodified guest operating system to run in isolation within a virtual machine, residing on a server. The guest OS is unaware that it has been virtualized. There are two types of full virtualization: software-assisted and hardware-assisted.
- Software-assisted full virtualization typically involves time consuming processes such as binary translation. A classic way to implement binary translation virtualization is through the trap-and-emulate approach. In this method, the hypervisor configures the CPU so that all potentially unsafe instructions will cause a trap, or an exceptional condition that transfers control back to the hypervisor. After the hypervisor receives a trap, it inspects the instruction, emulates it in a safe way, and continues execution of the instruction.
- Binary translation virtualization can be combined with direct execution, in which most code is executed directly on the CPU and only code that requires translation actually gets translated. Alternatives to binary translation virtualization include binary patching and full system emulation.
- Hypervisor software used in software-assisted full virtualization includes VMware workstation (32-bit guests), VMWare Server, Virtual PC, and Oracle VM VirtualBox (32-bit guests).
- However, VirtualBox, a type 2 hypervisor, takes its own approach to virtualization. When starting a VM through its ring-0 support kernel driver, VirtualBox sets up the host system to run most of the guest code natively. Yet VirtualBox also inserts itself so that it can assume control when needed, such as when a privileged instruction is executed. When trapping occurs, VirtualBox manages the situation by routing a request to a virtual device or by delegating handling to the guest or host OS. VirtualBox also provides paravirtualization interfaces.
- Hardware-assisted full virtualization eliminates the need for binary translation virtualization or its alternatives. Hardware-assisted virtualization relies instead on hardware extensions that help the hypervisor to manage complex tasks at the processor level. This includes X86 virtualization technology such as the Intel Virtualization Technology and Advanced Micro Devices (AMD) virtualization processor command set extensions.
- Bare metal hypervisor software (type 1) which supports hardware-assisted virtualization includes VMware ESXi /ESX, Hyper-V, KVM (a part of the Linux kernel which can run VMs directly), and Xen/Xenserver.
- Hosted hypervisor software (type 2) supporting hardware-assisted full virtualization (type 2) includes VMware Workstation (64-bit guests only), VirtualBox (64-bit guests only), and VMware Server (retired). VMWorkstation/Server supports both Linux and Windows.
What is Partial Virtualization?
In partial virtualization, certain applications – as opposed to an entire OS – are run in VMs. Partial virtualization can involve only a few applications or many. As its name implies, partial virtualization simulates the physical hardware of the system, but only partially.
Pros and Cons: Paravirtualization vs. Full vs. Partial Virtualization
- Paravirtualization is designed to enhance system performance and minimize overhead, preventing the underutilization of VMs. It scales very efficiently. Paravirtualization also eases the operation of different OS on a single set or hardware by lessening the time required for completing operations. On the down side, though, an unmodified OS such as Windows won't operate on a paravirtualized hypervisor like Xen, unless, perhaps, with paravirtualization drivers for the OS. Also, the performance advantage of paravirtualization over full virtualization can vary considerably according to type of workload.
- Full Virtualization, the development of hardware-assisted technology has been a major game changer. Hardware-assisted virtualization takes a huge step forward from software-assisted full virtualization by offloading many time consuming tasks from which would otherwise be performed by a hypervisor or VM manager (VMM). As a minor limitation, however, hardware-assisted full virtualization doesn't support legacy hardware that has incompatible processors.
- Partial Virtualization is much easier to implement than full virtualization and can work well for sharing resources among multiple users. Yet partial virtualization can't be used in situations requiring backward compatibility or portability, due to the difficulty of anticipating which features have already been used by specific applications.
Ideal Uses of Paravirtualization
Paravirtualization technology excels at efficient system utilization and scalability, power conservation, and easy backup. One of the most prevalent uses of paravirtualization is for partitioning environments from test systems.
Yet there are plenty of other applications that continue to take advantage of its capabilities, too, including server consolidation, data migration, disaster recovery, and capacity management.