What's the differences between Xen, QEMU and KVM?

57,454

Solution 1

QEMU is a powerful emulator, which means that it can emulate a variety of processor types.

Xen uses QEMU for HVM guests, more specifically for the HVM guest's device model. The Xen-specific QEMU is called qemu-dm (short for QEMU device model)

QEMU uses emulation; KVM uses processor extensions (HVM) for virtualization.

Both Xen and KVM merge their various functionality to upstream QEMU, that way upstream QEMU can be used directly to accomplish Xen device model emulation, etc.

Xen is unique in that it has paravirtualized guests that don't require hardware virtualization.

Both Xen and KVM have paravirtualized device drivers that can run on top of the HVM guests.

Solution 2

The above answers are in depth, technical. I try to put it in simple layman's terms.

Qemu is an emulator which can work with or without KVM which is an accelerator(linux kernel module which enables the guest instruction to run directly on the host CPU) which makes Qemu+KVM a faster solution, unlike the slower alternative of Qemu+TCG.

Xen is a bare metal hypervisor which has different modes(virtualization types ).By the way, bare metal is a misleading term. All hypervisors Type-II/hosted or Type-I/bare-metal needs an underlying OS. So bare metal also has a very thin layer of bare minimum operating system like layer which the hypervisor use.

Xen PV or Paravirtualized- No hardware emulation required, guest kernel is modified so that guest can detect/run on underlying Xen hypervisor.

Xen HVM or Fully Virtualized- Hardware emulation is required,acheived only on CPUs which supports virtualisation Intel-VT etc., modified Qemu is used for hardware emulation (disk,network,USB controllers etc), guest kernel is not modified.

Generally, emulated virtualization(full) is slower than modified kernel virtualization(para). By installing specialised drivers (PV drivers) in guest kernel, performance of fully virtualized guests can be improved.

Solution 3

KVM is a hypervisor as a kernel module, emulates special instructions like vmon, wrmsr, vmwrite, etc. It manages Virtual Machine like a virtual CPU. Though it can emulate some virtual devices, it would be better to emulate these devices in user mode. So QEMU emulates these devices like network card, storage devices, usb controller and more. We can use vhost to accelerate network by emulating virtio operation in Host kernel.

Because KVM is a kernel module, so Host OS is managing hardware directly instead of hypervisor. Like left part of following picture.

Xen is a Paravirtualization platform. Its hypervisor is managing hardware directly. After booting hypervisor, hypervisor creates a root Virtual Machine as Host. When booting a new Virtual Machine, VM is running at the same level as Host.

Virtual devices can be emulated in Host's userland using QEMU. they can be emulated in Host's kernel, too.

enter image description here

Share:
57,454

Related videos on Youtube

Xorax
Author by

Xorax

Updated on July 05, 2022

Comments

  • Xorax
    Xorax almost 2 years

    I know QEMU is used by Xen, and KVM is a fork of QEMU.

    So, KVM includes that Xen adds to QEMU ? What is the name ?

    Thanks

    • toraritte
      toraritte over 2 years
      This thread also seems helpful; excerpt: "QEMU is a machine (hardware) emulator. KVM is a kernel module for Linux to enable virtualization; this is the hypervisor. QEMU can run without KVM but it can be quite a bit slower."
  • ncultra
    ncultra about 11 years
    to add to the answer, KVM supports paravirtual guests as well through the paravirt-ops interface. paravirt-ops has been in Linux over six years. A kernel that supports paravirt-ops can run either on bare metal, through hardware virtualization support, or through paravirtualization
  • kumar
    kumar over 10 years
    PV guests - paravirtualized guests.
  • Devid Farinelli
    Devid Farinelli over 7 years
    I like this simple answer, but it doesn't explain what Xen is
  • pumpkin_cat
    pumpkin_cat almost 7 years
    Updated the answer.
  • Royi
    Royi almost 6 years
    How does, performance wise, Qemu + KVM (Gnome Boxes) compare to VirtualBox?
  • prl
    prl over 5 years
    There are a couple of errors in this answer. First, qemu is not a hypervisor. It can be used with the Xen or KVM hypervisors or it can be used without a hypervisor as a pure emulator.
  • prl
    prl over 5 years
    Second, it is not true that a bare-metal hypervisor needs an underlying OS. Some use an OS in a guest and some don’t need an OS at all.
  • pumpkin_cat
    pumpkin_cat over 5 years
    @prl Agree QEMU is a generic and open source machine emulator and virtualizer.(www.qemu.org)