virtual machine monitors: technology and trends jonathan kaldor cs614 / f07
TRANSCRIPT
![Page 1: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/1.jpg)
Virtual Machine Monitors:Technology and Trends
Jonathan Kaldor
CS614 / F07
![Page 2: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/2.jpg)
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
![Page 3: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/3.jpg)
Server A
Why a VMM?
Application A
Server B
Application B
Client (Windows)
Client (Windows)
Client (Linux)
OS A OS B
![Page 4: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/4.jpg)
Server A
Why a VMM?
Hardware consolidation
Application A Application B
Client (Windows)
Client (Windows)
Client (Linux)
OS A
![Page 5: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/5.jpg)
Server A
Why a VMM?
Hardware consolidation
Application A Application B
Client (Windows)
Client (Windows)
Client (Linux)
OS A
![Page 6: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/6.jpg)
Server A
Why a VMM?
Hardware consolidation
Application A Application B
Client (Windows)
Client (Windows)
Client (Linux)
OS A
Windows Linux
???
![Page 7: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/7.jpg)
Server A
Why a VMM?
Hardware consolidation
Application A Application B
Client (Windows)
Client (Linux)
OS A
![Page 8: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/8.jpg)
Server A
Why a VMM?
Hardware consolidation
Application A Application B
Client (Windows)
Client (Linux)
OS A
![Page 9: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/9.jpg)
Server A
Why a VMM?
Hardware consolidation
While preserving boundaries
Application A Application B
Client (Windows)
Client (Linux)
OS A
![Page 10: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/10.jpg)
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
![Page 11: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/11.jpg)
Applications
Server consolidation Application hosting Application mobility Security Reducing need for dual-booting
![Page 12: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/12.jpg)
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
![Page 13: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/13.jpg)
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)
![Page 14: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/14.jpg)
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?
![Page 15: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/15.jpg)
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
![Page 16: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/16.jpg)
(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
![Page 17: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/17.jpg)
(Para-) Virtualization, cont.
Arguments for paravirtualizationCan improve performance Important virtual/nonvirtual concepts
Time!
Architecture doesn’t necessarily work well with full virtualization
![Page 18: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/18.jpg)
(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?
![Page 19: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/19.jpg)
Design Decisions
Para-Virtualized Binary Translation
Exokernel Xen VMWare ESX
Hosted VMWare WS
(sort of)
![Page 20: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/20.jpg)
An example: Page Tables
VMWare: Keeps a shadow copy of page table
Application OS VMWare
Page Table Shadow Table
![Page 21: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/21.jpg)
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”
![Page 22: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/22.jpg)
An example: Page Tables
Xen: OS tells Xen about the page table, relinquishes write control
Application OS Xen
Page Table
![Page 23: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/23.jpg)
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”
![Page 24: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/24.jpg)
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
![Page 25: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/25.jpg)
Xen I/O
Use ring structure to queue requests / responsesEnables batching, reordering
Virtual Network InterfaceRules used to correctly route packetsAvoids copying via page trading
![Page 26: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/26.jpg)
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
![Page 27: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/27.jpg)
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
![Page 28: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/28.jpg)
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
![Page 29: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/29.jpg)
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
![Page 30: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/30.jpg)
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
![Page 31: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/31.jpg)
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
![Page 32: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/32.jpg)
Using the OS paging algorithm
Lesson: The VMM is necessarily a poor estimator of which page to claim
Use OS paging algorithm insteadBalloon process
![Page 33: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/33.jpg)
Using a Balloon Process
Guest OS
Page A
Page B
Page C
Page D
VMM
Main Memory
Disk
Balloon Process
“request memory”
![Page 34: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/34.jpg)
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!”
![Page 35: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/35.jpg)
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!”
![Page 36: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/36.jpg)
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”
![Page 37: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/37.jpg)
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
![Page 38: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/38.jpg)
Performance
![Page 39: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/39.jpg)
Performance
L: Native Linux, X: Xen, V: VMWare, U: User-Mode Linux
![Page 40: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/40.jpg)
Multi-OS Performance
![Page 41: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/41.jpg)
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
![Page 42: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/42.jpg)
Conclusions
Either approach works well in practice Small but noticeable performance penalty Becoming a nonissue
OS support for virtualization Microsoft Windows (?!)
Hardware support
![Page 43: Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07](https://reader036.vdocuments.mx/reader036/viewer/2022062518/56649ea85503460f94bab50d/html5/thumbnails/43.jpg)
The Future
Virtualization is probably going to become more commonplace
Hardware support will hopefully eliminate some issues
In a way, back to where we startedResurrection of an old research idea to solve
new problems