What is Xen?
Xen is the commonly used name for the Xen Project hypervisor. It is currently developed by the Linux Foundation with support from Intel. Similar to KVM, it aims to provide a mechanism through which the Linux kernel can be used as a hypervisor when virtualizing computer systems.
Starting as a project at the University of Cambridge in 2003, the Xen Project is an open source hypervisor implementation using a modified Linux kernel as a base. It’s available through commercial solutions such as Citrix’s XenServer, or alternatively it can be configured for free on a number of Linux hosts such as Debian, CentOS and Red Hat. Xen can allow guests to run with full hardware virtualization, as well as with hypervisors like KVM, and it can also run guests using paravirtualization.
What is Paravirtualization?
Paravirtualization is a technology that involves the guest operating system being modified in order to make specific calls to the underlying hypervisor instead of to the hardware. As such the guest operating system is aware that it is running in a virtualized environment so that it can accelerate things by requesting specific resources from the host, rather than the host having to provide emulated interfaces. This allows Xen to run guests on hardware that doesn’t have any hardware virtualization extensions, in addition to potentially increasing the performance of guest systems. While Xen is capable of running a number of guest operating systems ranging from Linux distributions, UNIX-like systems and Microsoft’s Windows, only systems that can run a modified kernel can take advantage of the paravirtualization functions.
A downside to the paravirtualization is that the modifications to the guest operating system are vital to its stable running. For example, changing the kernel of a paravirtualized Linux guest system to one without the Xen modifications will cause the guest to crash at startup.
Xen Full Virtualization Mode
When Xen runs a guest in full virtualization mode there’s no need for the modified kernels on the guest systems. The host does need to have hardware virtualization extension such as VT-x or AMD-V available and enabled in order to run a guest in full virtualization mode.
Unlike a number of other virtualisation systems that manage their virtual hard drives by creating files on the host’s filesystem for storage, Xen can use Linux logical volume management in order to create logical volumes which are used for datastores. This means that there are plenty of tools available for managing the disk images, but also that they could be easily mounted by the host operating system, or by another should the need arise to work on the disk if the virtual machine fails to boot.
As with a number of other hypervisor host systems for Linux, the standard Xen hypervisor is controlled via the command line. There are a number of other tools that can also be used for managing the guest virtual machines, such as Virtual Machine Manager, that provide a graphical user interface which can make things easier to work with.
A useful feature of the Xen hypervisor is the ability to live migrate a guest virtual machine from one physical host to another. This is achieved by incrementally copying the memory from the running virtual machine to the host it is being moved to. At the point of migration the running machine is paused, a final synchronisation of the memory takes place, then the guest virtual machine resumes running on the new host. This process can take place with the guest virtual machine only experiencing downtime measured in fractions of a second.
Features like the live migration and paravirtualization performance have ensured that the Xen Project has proven a popular hypervisor for a number of hosting providers that provide virtual private servers to the public. This means that it is well supported with regular updates and plenty of help online.