Virtual Machine Monitors: Technology and Trends
-
Upload
emery-joseph -
Category
Documents
-
view
45 -
download
1
description
Transcript of Virtual Machine Monitors: Technology and Trends
Virtual machine Monitors (VMMs)
Allow users to run multiple commodity OSes on a single piece of hardwareApplications unchangedResources fairly distributed and multiplexed
Can get, but doesn’t need help from hardware/OSMain difference between two papers
Server A
Why a VMM?
Application A
Server B
Application B
Client (Windows)
Client (Windows)
Client (Linux)
OS A OS B
Server A
Why a VMM?
Hardware consolidation
Application A Application B
Client (Windows)
Client (Windows)
Client (Linux)
OS A
Server A
Why a VMM?
Hardware consolidation
Application A Application B
Client (Windows)
Client (Windows)
Client (Linux)
OS A
Server A
Why a VMM?
Hardware consolidation
Application A Application B
Client (Windows)
Client (Windows)
Client (Linux)
OS A
Windows Linux
???
Server A
Why a VMM?
Hardware consolidation
Application A Application B
Client (Windows)
Client (Linux)
OS A
Server A
Why a VMM?
Hardware consolidation
Application A Application B
Client (Windows)
Client (Linux)
OS A
Server A
Why a VMM?
Hardware consolidation
While preserving boundaries
Application A Application B
Client (Windows)
Client (Linux)
OS A
Server A
Why a VMM?
Hardware consolidation
While preserving boundaries
Application A Application B
Client (Windows)
Client (Windows)
Client (Linux)
Guest OS A Guest OS B
VMM
Applications
Server consolidation Application hosting Application mobility Security Reducing need for dual-booting
VMM Organizational Types
Exokernel-like layer (Type I) Multiplexes and manages
hardware through virtual layer
Layered on Host OS (Type II) Use HostOS to interface with
hardware
Hardware
VMM
VM VM VM
GuestOS GuestOS GuestOS
App App App App App
Hardware
VMM
VM VM
GuestOS GuestOS
App App App
HostOS
App
To Host or Not to Host
Hosted eases developmentCan use HostOS drivers to interface with
hardware But performs poorly
Hybrid systems (modify HostOS for performance)
Performance
Run code directly on CPU for speed Conflicting requirements:
VMM needs to maintain controlOS assumes it is privileged
Solution: run Guest OS code directly in less-privileged levelHow to deal with the consequences?
Hardware 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
environmentSilent failures, multiple outcomes, etc
Hardware page tablesNontrivial for VMM to exert control
(Para-) Virtualization
OS no longer has complete control over hardware
ParavirtualizationProvide alternatives to privileged instructionsRequires modifying source code of GuestOS
Binary TranslationTranslate privileged instructions to virtualized
alternatives while running
(Para-) Virtualization, cont.
Arguments for paravirtualizationCan improve performance Important virtual/nonvirtual concepts
Time!
Architecture doesn’t necessarily work well with full virtualization
(Para-) Virtualization, cont.
Arguments for binary translationDoes not require access to sourceUnrealistic at times to modify the OS
*cough*Windows*cough* Legacy apps compatible with older OSes
Can be reasonably fast?
Design Decisions
Para-Virtualized Binary Translation
Exokernel Xen VMWare ESX
Hosted VMWare WS
(sort of)
An example: Page Tables
VMWare: Keeps a shadow copy of page table
Application OS VMWare
Page Table Shadow Table
An example: Page Tables
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
Application OS VMWare
Page Table Shadow Table
“Add page 10”
“Add page 52”
An example: Page Tables
Xen: OS tells Xen about the page table, relinquishes write control
Application OS Xen
Page Table
An example: Page Tables
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
Application OS Xen
Page Table
“Add page 10”
Xen: Improving Performance
Minimize TLB flushesXen lives at top 64MB of every address space
Allow batch updates/requests to Xen I/O, page tables, etc
OS-specified handlersNeed to guarantee safety
Xen I/O
Use ring structure to queue requests / responsesEnables batching, reordering
Virtual Network InterfaceRules used to correctly route packetsAvoids copying via page trading
Oversubscribing 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
Disk Paging Policy Decisions at the VMM Level
VMM decides to take a page from the OS
Guest OS
Page A
Page B
Page C
Page D
VMM
Main Memory
Disk
Disk Paging Policy Decisions at the VMM Level
VMM decides to take a page from the OS
Guest OS
Page A
Page B
Page C
Page D
VMM
Main Memory
Disk
Disk 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
Guest OS
Page A
Page B
Page C
Page D
VMM
Main Memory
Disk
Disk 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…
Guest OS
Page A
Page B
Page C
Page D
VMM
Main Memory
Disk
Disk 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!
Guest OS
Page A
Page B
Page C
Page D
VMM
Main Memory
Disk
Using the OS paging algorithm
Lesson: The VMM is necessarily a poor estimator of which page to claim
Use OS paging algorithm insteadBalloon process
Using a Balloon Process
Guest OS
Page A
Page B
Page C
Page D
VMM
Main Memory
Disk
Balloon Process
“request memory”
Using a Balloon Process
Guest OS
Page A
Page B
Page C
Page D
VMM
Main Memory
Disk
Balloon Process
“request memory”
“process needs pages badly!”
Using a Balloon Process
Guest OS
Page A
Page B
Page C
Page D
VMM
Main Memory
Disk
Balloon Process
“request memory”
“process needs pages badly!”
Using a Balloon Process
Guest OS
Page A
Page B
Page C
Page D
VMM
Main Memory
Disk
Balloon Process
“he gave me page c”
“take page c”
Additional Memory Tricks
Still need a paging algorithm in case ballooning fails
Potentially many copies of the same pageDetect these, remap them with copy-on-writeVMWare: 7-30% memory savings in real
world
Xen Versus VMWare ESX (with a bucket of salt)
From “A Performance Comparison of Commercial Hypervisors”, XenSource
http://www.xensource.com/Documents/hypervisor_performance_comparison_1_0_5_with_esx-data.pdf
Conclusions
Either approach works well in practice Small but noticeable performance penalty Becoming a nonissue
OS support for virtualization Microsoft Windows (?!)
Hardware support