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

VirtualizationQemuXenKvm

Virtualization Problem Overview


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

Virtualization Solutions


Solution 1 - Virtualization

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 - Virtualization

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 - Virtualization

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionXoraxView Question on Stackoverflow
Solution 1 - VirtualizationTodd DeshaneView Answer on Stackoverflow
Solution 2 - Virtualizationpumpkin_catView Answer on Stackoverflow
Solution 3 - VirtualizationVictorVView Answer on Stackoverflow