An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of...

22
An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: [email protected] URL: http://www.johnw.idv.tw

Transcript of An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of...

Page 1: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

An Introduction to Xen

Prof. Chih-Hung WuDept. of Electrical Engineering

National University of KaohsiungEmail: [email protected]

URL: http://www.johnw.idv.tw

Page 2: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

History of virtualization development

• 1965 IBM M44/44X paging system• 1965 IBM System/360-67 virtual memory

hardware• 1967 IBM CP-40 (January) and CP-67

(April) time-sharing• 1972 IBM VM/370 run VM under VM • 1997 Connectix First version of Virtual PC • 1998 VMWare U.S. Patent 6,397,242• 1999 VMware Virtual Platform for the

Intel IA-32 architecture• 2000 IBM z/VM• 2001 Connectix Virtual PC for Windows• 2003 Microsoft acquired Connectix • 2003 EMC acquired Vmware• 2003 VERITAS acquired Ejascent • 2005 HP Integrity Virtual Machines

• 2005 Intel VT• 2006 AMD VT• 2005 XEN• 2006 VMWare Server• 2006 Virtual PC 2006• 2006 HP IVM Version 2.0• 2006 Virtual Iron 3.1• 2007 InnoTek VirtualBox• 2007 KVM in Linux Kernel• 2007 XEN in Linux Kernel

Page 3: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

What Is Xen?

• Xen aims to be able to execute multiple operating systems on one physical x86 machine:– Support popular OS (Linux, Windows XP, NetBSD), – Scalable up to around 100 VMs,– Securely,– With close-to-native performance.

• Xen is a virtual machine monitor (VMM).

Page 4: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

What is Xen?

• The Xen® hypervisor, the powerful open source industry standard for virtualization, offers a powerful, efficient, and secure feature set for virtualization of x86, x86_64, IA64, PowerPC, and other CPU architectures. It supports a wide range of guest operating systems including Windows®, Linux®, Solaris®, and various versions of the BSD operating systems. – Xen.org releases Xen 3.4 - The Yankee Groups Third Annual Virtualiz

ation Survey reports a significant increase of commercial Xen-based solutions which represent 17 percent of total market share.

– "I think Xen is a great product. It is easy to use. But most importantly is the very active community around it...", Werner Vogels,CTO Amazon.com from his video interview on Virtualization.com

Page 5: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Xen Architecture

Source: Xen and the Art of Virtualization (Xen 1.x.) Published at SOSP 2003

Page 6: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Xen Jargon

• The hypervisor– The Xen VMM

– A particular Xen version which handles low level functionality

• Guest Operating System– The operating system that Xen hosts

• Domain– The virtual machine under which a guest operating sy

stem executes

• Guest OS and a domain similar to idea of a program and a process

Page 7: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Xen Architecture (Cont.)

• Domain0 can use the admin interface to command the hypervisor,

• Domain0 uses a privileged kernel (Dom0 kernel) capable of accessing the hardware of the machine,

• Other guests use a DomU kernel which is typically more restricted.

Page 8: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Xen 3.4.0

• Available from Xen Source (http://www.xen.org )• In association with University of Cambridge (http://

www.cl.cam.ac.uk/Research/SRG/netos/xen/)• Support for 64-Bit and 32-way machines• Supports IntelVT and AMD-V• Linux support only, Windows expected later this year• Open Source Product – One of the most actively main

tained projects in the open source community• $ - Free• Latest Current Version: Xen 3.4.0

Page 9: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Xen

• Xen already is bundled in some distributions, CentOS 5.3, Fedora Core 4, Debian and SuSE Professional 9.3

• The Fedora Project has RPMs for installing Xen, and other Linux distros have prepared installation packages for Xen as well.

Page 10: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Types of virtualization

• Two categories exist– Full Virtualization– Paravirtualization

Page 11: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Paravirtualization -- Xen Approach

• Virtual machine is NOT 100% functionally equivalent to the hardware

• Xen uses paravirtualization instead• Paravirtualization is a process where the guest

operating system is modified to run in parallel with other modified systems– Advantage: Improved performance– Disadvantage: The hosted operating system must

be modified before it can be hosted by the Xen Hypervisor (can be difficult)

Page 12: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Hypervisor Control

• In Xen– Domain0 is given greater

access to the hardware and the hypervisor. It has:

• A guest OS running above the domain

• Hypervisor Manager software to manage elements within other existing domains.

• In VMWare– Host OS acts underneath

the domain. Host Operating System

VMWare Drivers

Other Drivers

Guest OS

VMWare

Guest OS

VM VM

VM Specific Drivers

VM Specific Drivers

Guest OS on Domain 0

Hypervisor

Domain 0

Hypervisor Manager

Guest OS on Domain X

Domain 1

Page 13: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

HVM in Xen

• Paravirtualization – Xen patches the kernel.

• HVM for full virtualization – Xen supports full virtualization so that the kernel c

an run on it unpatched. – For example, both Intel VT and AMD Pacifica pro

cessors will include such support.

Page 14: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Virtual Networking in Xen

Source: http://wiki.xensource.com/xenwiki/XenNetworking

Page 15: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Virtual Networking in Xen

Source: http://wiki.xensource.com/xenwiki/XenNetworking

Page 16: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Virtual Networking in Xen

Source: http://wiki.xensource.com/xenwiki/XenNetworking

Page 17: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Virtual Networking in Xen

Source: http://wiki.xensource.com/xenwiki/XenNetworking

Page 18: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Virtual Networking in Xen

Source: http://wiki.xensource.com/xenwiki/XenNetworking

Page 19: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Live Migration

• Xen supports live migration over LAN,

• Uses ‘pre-copy’ method:– Iteratively copy memory,– Pause the VM,– Copy rest of the memory,– Start VM in on new machine.

• ARP is used to signal the network that the IP has moved.

• Disk is provided by NAS.

Page 20: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Requirements For Running Xen

• A working Linux distribution using the GRUB bootloader and running on a P6-class (or newer) CPU,

• More than 1GB RAM (suggested)• iproute2, bridge-utils, gcc, binutils, make, libcurl-devel,

zlib-dev, python-dev,• Don’t need to reinstall to try it:

– Build Xen in your existing Linux install (which will become Domain0),

– Use a file backed filesytem for guests.

• You can try it using a bootable live CD.

Page 21: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Current Status (Xen 3.x)

• Secure isolation between VMs,• Resource control and QoS,• Only guest kernel needs to be ported,• All user-level apps and libraries run unmodified• Linux 2.4/2.6, NetBSD, CentOS 5, FreeBSD, Plan9,

and more • Execution performance is close to native,• Supports the same hardware as Linux x86,• Live Relocation of VMs between Xen nodes.

Source : Overview of Xen 3.0. Describes the progression from Xen 2.0 to 3.0.

Page 22: An Introduction to Xen Prof. Chih-Hung Wu Dept. of Electrical Engineering National University of Kaohsiung Email: johnw@nuk.edu.twjohnw@nuk.edu.tw URL:

ICAL

Performance

Relative performance on native Linux (L), Xen/Linux (X),VMware Workstation 3.2 (V), and User Mode Linux (U).