Title: Virtual Machine Monitors: Technology and Trends
1Virtual Machine MonitorsTechnology and Trends
- Jonathan Kaldor
- CS614 / F07
2Virtual machine Monitors (VMMs)
- Allow users to run multiple commodity OSes on a
single piece of hardware - Applications unchanged
- Resources fairly distributed and multiplexed
- Can get, but doesnt need help from hardware/OS
- Main difference between two papers
3Why a VMM?
Server A
Server B
OS A
OS B
Application A
Application B
Client (Windows)
Client (Windows)
Client (Linux)
4Why a VMM?
Server A
OS A
Application A
Application B
Client (Windows)
Client (Windows)
Client (Linux)
5Why a VMM?
Server A
OS A
Application A
Application B
Client (Windows)
Client (Windows)
Client (Linux)
6Why a VMM?
Server A
OS A
???
Application A
Application B
Windows
Linux
Client (Windows)
Client (Windows)
Client (Linux)
7Why a VMM?
Server A
OS A
Application A
Application B
Client (Windows)
Client (Linux)
8Why a VMM?
Server A
OS A
Application A
Application B
Client (Windows)
Client (Linux)
9Why a VMM?
Server A
- Hardware consolidation
- While preserving boundaries
OS A
Application A
Application B
Client (Windows)
Client (Linux)
10Why a VMM?
Server A
- Hardware consolidation
- While preserving boundaries
VMM
Guest OS A
Guest OS B
Application A
Application B
Client (Windows)
Client (Windows)
Client (Linux)
11Applications
- Server consolidation
- Application hosting
- Application mobility
- Security
- Reducing need for dual-booting
12VMM Organizational Types
App
App
App
App
App
App
App
App
GuestOS
GuestOS
GuestOS
GuestOS
GuestOS
VM
VM
VM
VM
VM
VMM
App
VMM
HostOS
Hardware
Hardware
- Exokernel-like layer (Type I)
- Multiplexes and manages hardware through virtual
layer
- Layered on Host OS (Type II)
- Use HostOS to interface with hardware
13To Host or Not to Host
- Hosted eases development
- Can use HostOS drivers to interface with hardware
- But performs poorly
- Hybrid systems (modify HostOS for performance)
14Performance
- Run code directly on CPU for speed
- Conflicting requirements
- VMM needs to maintain control
- OS assumes it is privileged
- Solution run Guest OS code directly in
less-privileged level - How to deal with the consequences?
15Hardware Issues(or why no one has ever called
x86 elegant, part 15,023)
- Allows multiple privilege levels (ring 0-3)
- ISA can be ill-defined in virtualized environment
- Silent failures, multiple outcomes, etc
- Hardware page tables
- Nontrivial for VMM to exert control
16(Para-) Virtualization
- OS no longer has complete control over hardware
- Paravirtualization
- Provide alternatives to privileged instructions
- Requires modifying source code of GuestOS
- Binary Translation
- Translate privileged instructions to virtualized
alternatives while running
17(Para-) Virtualization, cont.
- Arguments for paravirtualization
- Can improve performance
- Important virtual/nonvirtual concepts
- Time!
- Architecture doesnt necessarily work well with
full virtualization
18(Para-) Virtualization, cont.
- Arguments for binary translation
- Does not require access to source
- Unrealistic at times to modify the OS
- coughWindowscough
- Legacy apps compatible with older OSes
- Can be reasonably fast?
19Design Decisions
Para-Virtualized Binary Translation
Exokernel Xen VMWare ESX
Hosted VMWare WS (sort of)
20An example Page Tables
Application
OS
VMWare
Shadow Table
Page Table
- VMWare Keeps a shadow copy of page table
21An example Page Tables
Application
OS
VMWare
Shadow Table
Page Table
- VMWare Keeps a shadow copy of page table
- Detects when change is made, makes corresponding
change to shadow table - Translation from OS address to machine address
22An example Page Tables
Application
OS
Xen
Page Table
- Xen OS tells Xen about the page table,
relinquishes write control
23An example Page Tables
Application
OS
Xen
Add page 10
Page Table
- Xen OS tells Xen about the page table,
relinquishes write control - OS tells Xen what updates it wants to make
- Xen ensures updates are legal, can batch
24Xen Improving Performance
- Minimize TLB flushes
- Xen lives at top 64MB of every address space
- Allow batch updates/requests to Xen
- I/O, page tables, etc
- OS-specified handlers
- Need to guarantee safety
25Xen I/O
- Use ring structure to queue requests / responses
- Enables batching, reordering
- Virtual Network Interface
- Rules used to correctly route packets
- Avoids copying via page trading
26Oversubscribing Memory
- Hundreds of OSes, each with 128MB of maximum
memory - Need to efficiently allocate memory among OSes,
effectively page to disk - Disk paging at VMM level can result in poor
behavior
27Disk Paging Policy Decisions at the VMM Level
- VMM decides to take a page from the OS
VMM
Guest OS
Main Memory
Page A
Page B
Page C
Page D
28Disk Paging Policy Decisions at the VMM Level
- VMM decides to take a page from the OS
VMM
Guest OS
Main Memory
Page A
Page B
Page C
Page D
29Disk Paging Policy Decisions at the VMM Level
- VMM decides to take a page from the OS
- OS decides to page to disk as well, picks same
page
VMM
Guest OS
Main Memory
Page A
Page B
Page C
Page D
30Disk Paging Policy Decisions at the VMM Level
- VMM decides to take a page from the OS
- OS decides to page to disk as well, picks same
page - VMM now needs to reload page from disk
VMM
Guest OS
Main Memory
Page A
Page B
Page C
Page D
31Disk Paging Policy Decisions at the VMM Level
- VMM decides to take a page from the OS
- OS decides to page to disk as well, picks same
page - VMM now needs to reload page from disk
- solely so the Guest OS can write it back out to
disk!
VMM
Guest OS
Main Memory
Page A
Page B
Page C
Page D
32Using the OS paging algorithm
- Lesson The VMM is necessarily a poor estimator
of which page to claim - Use OS paging algorithm instead
- Balloon process
33Using a Balloon Process
request memory
Guest OS
VMM
Balloon Process
Main Memory
Page A
Page B
Page C
Page D
34Using a Balloon Process
request memory
Guest OS
VMM
Balloon Process
Main Memory
Page A
Page B
Page C
Page D
process needs pages badly!
35Using a Balloon Process
request memory
Guest OS
VMM
Balloon Process
Main Memory
Page A
Page B
Page C
Page D
process needs pages badly!
36Using a Balloon Process
he gave me page c
Guest OS
VMM
Balloon Process
Main Memory
Page A
Page B
Page C
Page D
take page c
37Additional Memory Tricks
- Still need a paging algorithm in case ballooning
fails - Potentially many copies of the same page
- Detect these, remap them with copy-on-write
- VMWare 7-30 memory savings in real world
38Performance
39Performance
L Native Linux, X Xen, V VMWare, U User-Mode
Linux
40Multi-OS Performance
41Xen Versus VMWare ESX (with a bucket of salt)
From A Performance Comparison of Commercial
Hypervisors, XenSource http//www.xensource.com/D
ocuments/hypervisor_performance_comparison_1_0_5_w
ith_esx-data.pdf
42Conclusions
- Either approach works well in practice
- Small but noticeable performance penalty
- Becoming a nonissue
- OS support for virtualization
- Microsoft Windows (?!)
- Hardware support
43The Future
- Virtualization is probably going to become more
commonplace - Hardware support will hopefully eliminate some
issues - In a way, back to where we started
- Resurrection of an old research idea to solve new
problems