Virtualization & Containers

paravirtualization

/ PA-ra-vir-tu-al-i-za-tion /

Paravirtualization takes a different attitude from full virtualization. Instead of fooling the guest into thinking it is on real hardware, it tells the guest the truth — you are a virtual machine — and modifies the guest operating system so it actively cooperates with the hypervisor. The prefix para means alongside: the guest works alongside the hypervisor rather than being deceived by it. It is like the difference between a stage magician who hides the wires from the actor, versus simply telling the actor where the wires are so they can hit their marks more smoothly.

The mechanism centres on hypercalls. In a paravirtualized guest, the expensive, awkward operations that would otherwise have to be trapped or translated are replaced, in the guest's source code, by explicit calls into the hypervisor — a hypercall is to a hypervisor what a system call is to a kernel. So instead of executing a privileged instruction and hoping it traps, the guest simply asks the hypervisor directly: please update my page tables, or please send this network packet. Because the guest cooperates, the hypervisor avoids the cost of catching and emulating tricky instructions and the design can be cleaner and faster, especially for I/O. Xen made this approach famous.

The obvious price is that you must modify the guest operating system, which is fine for open-source kernels like Linux but impossible for a closed OS you cannot change. In practice the lines have blurred: modern systems often run a guest that is mostly hardware-virtualized but uses paravirtual drivers (like virtio) for the device I/O that benefits most from cooperation. So paravirtualization today survives less as whole-OS modification and more as cooperative, hypervisor-aware drivers inside an otherwise hardware-assisted guest.

A paravirtualized Linux guest needs to send a network packet. Rather than poking at an emulated network card register by register (which would trap many times), it makes one virtio hypercall handing the packet straight to the hypervisor — far fewer round trips, much faster.

A cooperative guest asks the hypervisor directly via a hypercall, skipping device emulation.

Paravirtualization requires changing the guest OS, so it cannot run an unmodified closed-source system the way full virtualization can. Its modern legacy is paravirtual drivers (virtio) used inside otherwise hardware-assisted guests, not whole-OS rewrites.

Also called
PV半虛擬化