QEMU and KVM
QEMU models a complete computer in software. On Linux, KVM lets QEMU run supported guest code through the host CPU's virtualization features instead of translating every instruction.
itVirtualization, containers, and orchestration | OpenSkills.info
Intro
QEMU and KVM
A virtual machine needs more than a virtual CPU. It needs memory, storage, network interfaces, interrupt controllers, firmware, and a way to start and stop the guest. QEMU supplies that machine model in a user-space process. KVM supplies a Linux kernel interface for hardware-assisted CPU and memory virtualization.
You often see the pair written as QEMU/KVM because they divide one practical job. QEMU creates the virtual machine and emulates or connects its devices. KVM lets QEMU execute guest instructions with help from the host processor. Neither name describes the entire management stack.
The core mental model
Picture one virtual machine as one QEMU process.
QEMU allocates guest memory and presents virtual hardware. A virtual disk may be a host file. A virtual network card may connect to a user-mode network, a tap device, or another backend. Firmware or a bootloader starts inside the machine model just as it would on physical hardware.
When QEMU uses the KVM accelerator, it opens /dev/kvm. It creates a virtual machine and one or more virtual CPUs through KVM's file-descriptor and ioctl interface. KVM runs guest CPU code until an event needs attention in the kernel or QEMU. QEMU then handles the relevant device behavior or control operation.
This division explains a common source of confusion:
- QEMU without KVM can emulate a complete machine with the Tiny Code Generator, or TCG. It can even emulate a different CPU architecture.
- QEMU with KVM uses Linux hardware virtualization for supported host and guest combinations. This is virtualization rather than general cross-architecture CPU emulation.
- KVM without a user-space virtual machine monitor is an API, not a complete desktop application. A program still needs to allocate memory, create virtual CPUs, and provide a useful device model.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://www.qemu.org/
Supports
- QEMU project identity and official documentation entry point
- https://www.qemu.org/docs/master/system/introduction.html
Supports
- Complete machine model of CPU, memory, and emulated devices
- Accelerator roles, supported host combinations, and TCG default
- Architecture and machine-specific configuration warning
- https://www.qemu.org/docs/master/about/emulation.html
Supports
- TCG system and user-mode emulation
- Cross-architecture emulation scope
- https://www.qemu.org/docs/master/system/qemu-manpage.html
Supports
- Accelerator, machine, CPU, memory, boot, device, display, and network options
- Multiple accelerator fallback behavior
- Runtime machine configuration
- https://www.qemu.org/docs/master/system/device-emulation.html
Supports
- Device frontend, bus, backend, passthrough, and virtio concepts
- Guest-visible device and host-backend separation
- https://www.qemu.org/docs/master/system/images.html
Supports
- Raw and qcow2 characteristics
- Snapshots, backing files, image chains, and locking
- Distinction between disk and complete virtual machine state
- https://www.qemu.org/docs/master/tools/qemu-img.html
Supports
- Image create, info, check, convert, map, and rebase operations
- Warning against modifying images in use
- Format and backing-chain inspection
- https://www.qemu.org/docs/master/system/qemu-cpu-models.html
Supports
- Host passthrough, named CPU models, and feature configuration
- CPU model tradeoffs for performance and migration
- QEMU and libvirt CPU configuration forms
- https://www.qemu.org/docs/master/system/monitor.html
Supports
- Human monitor purpose and commands
- Runtime inspection and control
- https://www.qemu.org/docs/master/interop/qmp-intro.html
Supports
- QMP as a JSON protocol for application control
- Machine-oriented command and event interface
- https://www.qemu.org/docs/master/system/security.html
Supports
- Virtualization and non-virtualization security-use distinctions
- Supported machine types for the virtualization security model
- Device, process, and deployment attack-surface considerations
- https://docs.kernel.org/virt/kvm/index.html
Supports
- Canonical Linux KVM documentation index
- KVM API, device, and architecture documentation
- https://docs.kernel.org/virt/kvm/api.html
Supports
- File-descriptor and ioctl structure of the KVM userspace API
- System, virtual machine, and virtual CPU object creation
- Guest memory registration, run structure, and exit handling
- https://libvirt.org/drvqemu.html
Supports
- Libvirt management of QEMU with KVM, TCG, and other accelerators
- Process security architecture and migration compatibility
- https://libvirt.org/formatdomain.html
Supports
- Domain definitions for CPU, memory, storage, networking, and devices
- QEMU and KVM domain configuration vocabulary
- https://github.com/sindresorhus/awesome
Supports
- Starting index used for the required awesome-list discovery
- https://github.com/Wenzel/awesome-virtualization
Supports
- Discovery of Firecracker, crosvm, Cloud Hypervisor, and rust-vmm
- Curated virtualization ecosystem and KVM and QEMU sections
- https://firecracker-microvm.github.io/
Supports
- Firecracker as a KVM-based virtual machine monitor
- Minimal device model and microVM workload focus
- https://crosvm.dev/book/
Supports
- crosvm as a virtual machine monitor
- Per-device sandboxing, KVM origins, devices, architecture, and operation
- https://www.cloudhypervisor.org/
Supports
- Rust virtual machine monitor for modern cloud workloads
- Minimal emulation, virtio, passthrough, API, and migration scope
- https://github.com/rust-vmm/community
Supports
- Community for reusable Rust virtual machine monitor components
- KVM interface and virtio component ecosystem
