Xen and the Art of Virtualization
Class note
Overview
- High-performance VMM that support strict resource control among guest OSes
A vitual machine monitor?
- exports virtual machine abstraction
domain: a running virtual machine within which a guest OS executes
Hardware
- Run 多个os on a single physical machine
- Example: VMWare, Microsoft’s VitrualPC / VirtualServer, Parallels (Macintosh), Xen
A Java virtual machine (JVM) is an abstract computing machine that enables a computer to run a Java program. There are three notions of the JVM: specification, implementation, and instance. The specification is a document that formally describes what is required of a JVM implementation.
hypervisor
A computer on which a hypervisor is running one or more virtual machines is defined as a host machine. Each virtual machine is called a guest machine.
Type-1, native or bare-metal hypervisors These hypervisors run directly on the host's hardware to control the hardware and to manage guest operating systems.
Type-2 or hosted hypervisors These hypervisors run on a conventional operating system just as other computer programs do.
VMM Implementation Overview
VMM is an operating system that exposes a (virtual) hardware interface
________________ ____________
|Batch processing| |Time Sharing|
_________________ ____________
_______________________________________________________
| VM/370 |
________________________________________________________
_____________________________________________
| System 370 Machine |
_____________________________________________
Emulator and VM
Emulator is an interpreter, VM is a real hardware interface
Benefits of VM in Company
- Server consolidation
- Isolation
Internet Services
- Many applications now run inside the Internet
- Goal: allow anyone to upload to a new service into the Internet
- Approach: use VMMs to provide a rent-a-server economy
EC2
- Scalability
- New machines can be created in minutes
- Security
- Isolation
- Developer control
- Low cost
Xen Requirement
- isolation among virtual machines
Paravirtualization
Paravirtualization is an enhancement of virtualization technology in which a guest OS is recompiled prior to installation inside a virtual machine. Paravirtualization allows for an interface to the virtual machine that can differ somewhat from that of the underlying hardware.
- Different from full virtualization? Full: Directly run on the top
Os can’t directly control the hardware Hyper call: call Hyperviosr
Xen provides Machine interface
Comparing the Unix and VMM APIs
Unix | VMM | |
---|---|---|
Storage | File system | (virtual)Disk |
Networking | Sockets | (virtual)ethernet |
Memory | Virtual Memory | (virtual)Physical memory |
Display | /dev/console | (virtual)Keyboard, display device |
Boundary
- Both the guest OS and applications run in (physical) user-mode
- For each virtual machine, the VMM keeps a software mode bit:
- During a system call, switch to “kernel” mode
- On system call return, switch to “user” mode
CPU Virtualization
- How Xen virtualize the CPU
- Guest OS no longer run on highest privilege
- using ring 1 instread of ring 0
- Explicitly schedule CPU among guest OSes
- Guest OS no longer run on highest privilege
Memory
- Virtual Memory (application) -> Physical Memory (Guest OS)-> Machine Memory (VMM)
- (increasing privilege)
- assume a software-loaded TLB