Virtualization Types
Virtualization Types
Introductio
n Providing an interface to
Virtualization:
software that maps to some underlying
system.
A one-to-one mapping between a guest
and the host on which it runs
Virtualized system should be an “efficient,
isolated duplicate” of the real one.
Application sees
“virtual machine” as Application
address space,
Virtualization Layer
registers, and
instruction set .
OS
Examples:
Multiprogramming Hardware
Emulation for binaries
High-level language
VMMs (e.g., JVM)
System
Virtualization
Application
Application
OS
OS
Virtualization Layer
Virtualization Layer
OS
Hardware
Hardware
Classical Hosted
Virtualization Virtualization/
Emulation
System
Virtualization
Interfaces with operating system
Example: QEMU
Breaks CPU instructions into small ops, coded in C.
C code is compiled into small objects on native ISA.
dyngen utility runs code by dynamically
stitching objects together (dynamic code
generation).
Some Important
Terms
Virtual Machine (VM): An instance of of an
operating system running on a virtualized
system. Also known as a virtual or guest OS.
(Host)
May also have a
separate controlling Hardware
interface.
Virtualization
Challenges
Privileged Instructions
Handling architecture-imposed instruction
privilege levels.
Performance Requirements
Holding down the cost of VMM activities.
Memory Management
Managing multiple address spaces efficiently.
I/O Virtualization
Handling I/O requests from multiple
operating systems.
CPU Virtualization
Image Source: VMWare White Paper, “Understanding Full Virtualization, Paravirtualization, and
Hardware Assist”, 2007.
Binary Translation with Full Virtualization
“Hardware is
functionally identical
to underlying
architecture.”
Typically accomplished
through interpretation
or binary translation.
Advantage: Guest OS
will run without any
changes to source code.
Disadvantage:
Complex, usually
slower than
paravirtualization.
Image Source: VMWare White Paper, “Understanding Full Virtualization, Paravirtualization, and
Hardware Assist”, 2007.
Paravirtualizatio
n
Replace certain
unvirtualized sections
of OS code with
virtualization-friendly
code.
Virtual architecture
“similar but not
identical to the
underlying
architecture.”
Advantages: easier,
lower virtualization
overhead
Disadvantages: requires
Image Source: VMWare White Paper, “Understanding Full Virtualization, Paravirtualization, and
Hardware Assist”, 2007.
modifications to guest
OS
Performanc
e
Modern VMMs based
around trap-and-emulate .
Guest
When a guest OS executes CPU_INST OS
a privileged instruction,
control is passed to VMM
(VMM “traps” on
instruction), which decides TRAP VMM
how to handle instruction
. CPU_INST1
VMM generates
instructions to handle EXEC
trapped instruction
(emulation).
Non-privileged instructions
do not trap (system stays CPU_INST
in guest context).
Trap-and-Emulate
Problems
Trap-and-emulate is expensive
Requires context-switch from guest OS mode to
VMM.
fram
e
That’s a lot of
lookups!
Shadow Page
Tables
Shadow page tables map virtual memory to
machine memory .
One page table maintained per guest OS.
TLB(Translation Look aside Buffer) caches results
from shadow page tables.
Gues VMM
t
Shadow Page
Table
Updates are expensive
Drawbacks
On a write, the VMM must update the VM and
the shadow page table.
Switching Expense
Low-level I/O functionality happens at the VMM
level, requiring a context switch.
I/O Rings,
continued
Xen VMWare
Rings contain memory Ring buffer is
descriptors pointing to
I/O buffer regions constructed in and
declared in guest managed by VMM.
address space.
If VMM detects a great
Guest and VMM deposit deal of entries and exits,
and remove messages
using a producer- it starts queuing I/O
consumer model . requests in ring buffer .
Xen 3.0 places device Next interrupt triggers
drivers on their own
virtual domains, transmission of
minimizing the effect of accumulated
driver crashes. messages.
Summar
y
Current VMM implementations provide safe,
relatively efficient virtualization, albeit often at
the expense of theoretical soundness .
The x86 architecture requires a) binary translation,
b) paravirtualization, or c) hardware support to
virtualize.
2.
s
Singh, A. “An Introduction To Virtualization”, www.kernelthread.com, 2004.
6. Pratt, I. et al. “Xen 3.0 and the Art of Virtualization”, Linux Symposium 2005.
12. Silberschatz, A., Galvin, P., Gagne, G. Operating System Concepts, Eighth Edition.
Wiley & Sons, 2009.