Frequently Asked Question

What are KVM and QEMU, and how do they fit together?

KVM, Kernel-based Virtual Machine, is a kernel module, in the mainline since 2007, that turns Linux itself into a Type-1 hypervisor by exposing the CPU's hardware virtualisation extensions (Intel VT-x or AMD-V) through /dev/kvm. A program that opens that device can ask the kernel to run a chunk of code in guest mode: a separate CPU context with its own page tables, its own registers, and trap-and-emulate behaviour for privileged instructions. KVM itself only virtualises the CPU and memory; it does not emulate any devices.

QEMU is a userspace machine emulator that fills in the rest. It implements virtual disks, network cards, USB controllers, graphics cards, and a BIOS or UEFI firmware, and presents them to the guest as if they were real hardware. Run on its own, QEMU can emulate an entire CPU (useful for cross-architecture work like running ARM binaries on x86), but that is very slow. The standard setup is QEMU plus KVM: QEMU emulates the devices, KVM accelerates the CPU, and you get near-native performance. This is what almost every Linux cloud VM, every libvirt-managed guest, and every virsh invocation actually runs on underneath.

Video

Further reading and video