You are on page 1of 9

Comparison between open source solutions for

paravirtualization and full virtualization: Xen and
KVM








Guillermo de la Puente Allott
gdelapue@hawk.iit.edu



1 of 8

Introduction
Virtualization has become increasingly important in the computing industry in the past couple
of decades. The purpose of virtualization is to allow multiple OSs to run in the same machine,
making use of the same hardware but, in most cases, being isolated of one another. This is a
powerful idea with many uses, such us provide an isolated secure development environment for
programmers and testers and replicate the production environment for employee training.
Virtualized OSs are also very easy to duplicate, send, remove or restore.
However, the most relevant use of virtualization is in data centers and big servers. A very
powerful machine can be split in smaller running OSs, making them available for different
purposes and even to different people. This is the use that has made virtualization so popular, as
Internet keeps growing. Probably, its growth will continue exponentially during the next ones.
Virtualization can be achieved using different techniques, each one of them with its advantages
and disadvantages. The choice of which one to use only depends on the system requirements.
For server partitioning, the most adequate are paravirtualization and full virtualization. The
difference is only in implementation details: how the virtualized OSs are managed and how do
they make use of the machine hardware resources. However, since virtualization is getting more
important every day, it’s useful to know them both in order to choose the most appropriate one
and know better how data centers and Internet web servers work.
There are many virtualization solutions, some of them proprietary and some others open source.
With open source projects gaining more popularity, the two most famous open source tools
nowadays are Xen and KVM. While Xen is the best example of paravirtualization solution, KVM
only offers full virtualization. The competition between these two projects has been very
interesting to follow. KVM’s popularity increases despite the fact that it’s less mature than Xen,
which is already implemented by many Internet giants who have invested lots of resources in
this solution.




2 of 8

Paravirtualization
Characterized for improving a lot the performance compared to bare virtualization, this
technique is very old. The first commercial use of it was by IBM in 1972 with its operating
system VM.
A software layer is placed between the guest OSs and the hypervisor. Its objective is reducing the
amount of time spent executing difficult tasks. These tasks, which might require a lot of
processing time, executed in the software layer, are processed substantially faster than in the
virtual environment due to overheads and instruction translations. The mechanism followed is
that the guest OSs can communicate with the software layer, so they must be aware about being
executed in a virtual environment.
The hypervisor, which is the layer right on top of the hardware that translates the OSs calls to
the specific hardware architecture, will be simpler with this technique. These calls are often
referred as hypercalls.
The main limitation of paravirtualization is also what produces the advantage. Since the guest
OS needs to know that it’s in a virtual environment, the OS kernel must have this implemented.
In some cases, separate components are available to allow virtualization of an incompatible OS.

Full virtualization
When using full virtualization, the guest OSs don’t know that they are being executed in a virtual
environment. They believe the entire machine is for them to use, no hardware sharing with
other running operating systems.
In contrast with paravirtualization, any OS can run in a full virtual environment. Since it doesn’t
know that it’s communicating with a hypervisor instead of directly with the hardware, there’s no
need for specific functions. The kernels don’t need to be modified or components installed. The
hypervisor keeps the guest OSs isolated and balances the load among them.
A disadvantage of this technique is that every virtual machine needs to have the full instruction
set, drivers and any elements that if would require to be run on bare software, while in
paravirtualization this can be avoided by sharing the common elements between operating
systems.
3 of 8

Full virtualization would slow things down a lot unless there’s specific hardware collaboration.
The components that make this possible are the Intel VT-x and AMD-V extensions, which allow
a virtual guest to access directly hardware. That’s extremely important in network
communications and hard drive accesses. Intel and AMD added this capability to their
processors in 2006. Before that, full virtualization without a software layer was not an option.

Xen
The most extended open source solution for paravirtualization is Xen. Besides any guest OSs
configured, it requires an additional virtual machine with special privileges which reduces the
load in the other ones.
Published in 2003, Xen has had time to expand and become one of the most used solutions for
server virtualization. At first, it only supported paravirtualization, but in 2005 they added
support for Intel VT Technology making full virtualization also possible. Since 2007 it used to
belong to Citrix, who continued developing Xen as a free software project but also sold
enterprise versions. On April 2013, the Xen project was acquired by the Linux Foundation as a
Collaborative Project, so it will continue growing completely open source under GPLv2
licensing.
Xen’s approach consists in using a virtual machine, or domain in Xen’s technical vocabulary,
running a Linux OS as the software layer typical from paravirtualization. This virtual machine,
called dom0, has privileged access to the hypervisor and can perform certain tasks that the other
domains can’t.
The regular domains, called domU, communicate with the dom0 to access privileged tasks or
load drivers, which are stored only in dom0 with the idea of them being shared among all the
other domains. For example, the dom0 has the Network Backend Driver and the Block Backend
Driver, so when a domU needs to access the hard drive interface, it just uses the drivers installed
in the dom0.
Xen supports both paravirtualization (PV) and full virtualization (HVM), but it’s better known
because of its paravitualization. When using full virtualization, the domU doesn’t need to
interact with the dom0, since the guest OS doesn’t know about it being executed in a virtual
4 of 8

machine. Simpler solutions that only support full virtualization are available, such as KVM.
That’s why Xen might not be the best solution if only full virtualization is required.

Figure 1. Xen architecture
KVM
KVM stands for Kernel-based Virtual Machine, and it’s a full virtualization solution for Linux in
hardware containing virtualization extensions, VT-x for Intel or AMD-V for AMD products.
KVM is a relatively new tool, first released in 2007. Probably, it wouldn’t have become as
popular if it hadn’t been included in the 2.6.20 Linux kernel. At first it was a project from a
startup company, but Red Hat acquired it in 2008. It is maintained as a free open source
project, some parts licensed under LPGL v2 and others under GPL v2. Despite being very young,
its simplicity and the fact that it’s only focused in full virtualization have made it a very
successful project.
It’s included in the Linux kernel as a module, so it’s very easy to start using it. The module
doesn’t perform any emulation by itself, only exposes the /dev/kvm interface. This way, there’s
no complex hypervisor needed because the Linux kernel acts as the hypervisor. Virtual machines
running with KVM are Linux processes. These processes execute in guest mode, a new execution
mode that KVM introduced, but generally speaking it’s like any other regular process in the OS.
5 of 8

KVM can work as hypervisor in machines that don’t have the virtualization extensions, but that
is very inefficient. With QEMU, any architecture can be simulated. However, simulating very
different architectures than the one underneath can lead to poor performances.

Figure 2. KVM architecture

Xen and KVM comparison
There are four well known solutions in the marketplace right now: Xen, KVM, Microsoft Hyper-
V and VMware. The first two are open source and count with lots of support from the
community, and the last two are proprietary software. They have less community collaboration,
but obviously offer services that the free ones don’t.
Talking only about the open source alternatives, both Xen and KVM are very similar in
performance. Only in specific environments where performance is critical, the solution chosen is
really important.
Other factors are also present such as easier deployment and management with KVM. In fact,
where Xen is running a privileged guest OS and requires the other virtual machines to
communicate with the privileged one, KVM runs in a regular Linux distribution with just a
different process for each virtual machine. If we are guided by the KISS principle, which is “Keep
It Simple, Stupid!”, we would go with KVM.
6 of 8

However, in a collaborative environment, the guest OSs could use the resources more efficiently.
That’s the Xen approach. The dom0 doesn’t just assign resources and balances the load, it
makes the guest OSs to coordinate by themselves.
From a very wide point of view, it’s a matter of simplicity versus complexity. Now that both Xen
and KVM are ligated to the evolution of Linux, they will focus themselves on the things that
make them better than the other. KVM will continue the philosophy of being easy to deploy and
make efforts to improve its full virtualization, while the Xen Project will be focused in improving
paravirtualization performance with its collaborative model.
Even if KVM proves to be much better than the other, Xen won’t disappear since a few big
companies have invested lots of money in it. For example, Amazon Web Services uses Xen’s
virtualization for its Elastic Compute Cloud. With expensive proprietary competitors, some big
companies decided to use Xen because it has been the best solution for many years, good
performance at low cost.
Amazon chose Xen not only for being cheap to deploy, but for being open source. That way, it’s
been able to use modified versions of Xen to meet their needs. In fact, their EC2 network has
multiple Xen modified versions coexisting. Also, in a video interview to Wener Vogels, Amazon’s
CTO, he said that another key factor when deciding to use Xen was its active community, which
was really helpful to solve any kind of problems related with virtualization that they came
across.
KVM would have been a good alternative, also free and open source, but it was released in 2007.
Amazon and most of the computing companies had already started using Xen by that time.
KVM is now where Xen was when these big companies started using and supporting it. We’ll see
where is KVM five years from now, when it has had time to mature.






7 of 8

References
Paravirtualization. Wikipedia. Retrieved on August 25, 2013 from
(http://en.wikipedia.org/wiki/Paravirtualization)
Xen. Wikipedia. Retrieved on August 25, 2013 from (http://en.wikipedia.org/wiki/Xen)
Kernel-based Virtual Machine. Wikipedia. Retrieved on August 25, 2013 from
(http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine)
How does Xen work? Xen Project. Retrieved on August 25, 2013 from
(http://www-archive.xenproject.org/files/Marketing/HowDoesXenWork.pdf)
A Survey of Virtualization Technologies With Performance Testing. Joshua S. White, Adam W.
Pilbeam. Retrieved on August 25, 2013 from
(http://arxiv.org/ftp/arxiv/papers/1010/1010.3233.pdf)
Takemura, Chris and Crawford, Luke (2009) The book of Xen: a practical guide for the system
administrator.
Brodkin, Jon. (2013) Linux Foundation takes over Xen, enlists Amazon in war to rule the cloud.
Ars Technica, April 15. Retrieved on August 25, 2013 from
(http://arstechnica.com/information-technology/2013/04/linux-foundation-takes-over-
xen-enlists-amazon-in-war-to-rule-the-cloud/)
Zemlin, Jim. (2013) Welcome Xen as a Linux Foundation Collaborative Project. Linux
Foundation Zemlin’s blog, April 14. Retrieved on August 25, 2013 from
(http://www.linuxfoundation.org/news-media/blogs/browse/2013/04/welcome-xen-
linux-foundation-collaborative-project)
Colomer, Paco. (2013) ¿Qué virtualización es mejor Xen o KVM? NESSYS Blog, July 8.
Retrieved on August 26, 2013 from (http://blog.nessys.es/xen-vs-kvm/)
Karafilis, Lefteris. (2010) Virtualization, Paravirtualization, whatever you say!?!? IT Bully,
October 11. Retrieved on August 26, 2013 from
(http://www.itbully.com/articles/virtualization-paravirtualization-whatever-you-say)
Habib, Irfan. (2008) Virtualization with KVM. Linux Journal, February 1. Retrieved on August
26, 2013 from (http://www.linuxjournal.com/article/9764)
8 of 8

Wolski, Rich. (2008) Interview to Eucalyptus director Rich Wolski on open source cloud
computing, Xen and Amazon’s EC2. Retrieved on August 28, 2013 from
(http://vimeo.com/1296719)
Ideler, Hugo. (2013). Digging into Xen at EC2. Hugo Ideler’s Blog, January 11. Retrieved on
August 28, 2013 from (http://hugoideler.com/2013/01/digging-into-xen-at-ec2/)
Vogels, Werner. (2008) Interview to Werner Vogels, CTO Amazon.com. Retrieved on August 28,
2013 from (http://vimeo.com/1412282)