openskills.info
QEMU and KVM logoCourse Preview

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

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