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

3

85

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

Graycegrayheaded answered 24/4, 2012 at 23:19 Comment(1)
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."Lieu
C
85

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.

Caulfield answered 26/4, 2012 at 2:46 Comment(2)
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 paravirtualizationExogenous
PV guests - paravirtualized guests.Ravelment
G
66

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.

Gelid answered 4/3, 2016 at 18:49 Comment(8)
I like this simple answer, but it doesn't explain what Xen isConcupiscence
Updated the answer.Gelid
How does, performance wise, Qemu + KVM (Gnome Boxes) compare to VirtualBox?Hoekstra
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.Scots
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.Scots
@Scots Agree QEMU is a generic and open source machine emulator and virtualizer.(www.qemu.org)Gelid
@Scots What do you mean by "OS in a guest"? Did you mean like Dom0 in Xen? Is that what pumpkin_cat also meant by "So bare metal also has a very thin layer of bare minimum operating system like layer which the hypervisor use"?Qualification
@Aby, yes, Dom0 is a service OS that runs in a guest. I believe the answer is referring to an OS underneath or built into the hypervisor, which I disagree is necessary. (My hypervisor doesn't have one.)Scots
E
4

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

Eton answered 23/3, 2022 at 7:3 Comment(1)
One picture better then thousand words.Farci

© 2022 - 2024 — McMap. All rights reserved.