Virtualization Flashcards
What are the two kinds of hypervisors?
- Bare metal/Native: hypervisor between shared hardware and guest OS
- Hosted: hypervisor runs on top of OS, then hosts other OSes
What are the characteristics of full virtualization?
- Guest metal has no idea they are running on hypervisor
- Binaries do not change
- Only hypervisor keeps mapping between physical and machine pages
What is “trap and emulate”?
- OS tries to run something in the kernel from user mode
- Hypervisor traps this and executes it for the guest OS
What are the characteristics of paravirtualization?
- Must modify binaries to have hypervisor code in order to let it access the hypervisor more easily
- Guest OS or hypervisor keeps mapping between physical and machine pages (normally guest OS)
- More room for innovation
- Guest OS is aware of the hypervisor
- Guest OS is aware that physical memory may not be contiguous
What are the goals of virtualization?
- Virtualize hardware
- Effect data and control between guests and hypervisor
How does a hypervisor handle memory hierarchy?
- Normally handled by OS (each process has its own memory space)
- In hypervisor, each process is in its own protection domain (distinct page table in their OS)
- OS will have its own page table
- OS viewed as a process in the hypervisor
- Hypervisor takes care of virtual to physical page table translation via Shadow Page Table
- CPU uses page table for address translation (hardware PT is really the S-PT)
What is the order of page table mappings on a hypervisor? ( Full Virtualization)
- Virtual Page
- Page Table (on guest OS)
- Physical Page
- Shadow Page Table (on hypervisor)
- Machine Page
- TLB Hardware Page Table store mapping of Virtual Page to Machine Page (privileged instruction)
How is virtual/physical memory viewed by the different parties in a virtualized system? ( Full Virtualization)
- Virtual memory is an illusion of the user
- Physical memory is an illusion of the guest OS
- Memory allocated to each VM is not contiguous
- Physical memory page is mapped to machine page through S-PT by hypervisor
How big is the shadow page table? ( Full Virtualization)
- As big as the number of processors instantiated by the guest OS
- One S-PT per guest OS running
- On context switches, pointer of entry point into the S-PT changes
How is memory mapping handled in a paravirtualized system?
- Burden is shifted to the guest OS
- Guest OS maintains contiguous physical memory
- Guest OS maps physical memory to discontiguous hardware pages
- Guest OS hypercalls to hypervisor to switch/create/switch page table
- Dynamically increase memory
What is ballooning?
When an OS needs more memory, hypervisor can dynamically adjust the amount of memory a guest OS has
Needs device driver installed in OS
What is inflating? (Ballooning)
Hypervisor/house increases memory → pages out to disk
What is deflating? (Ballooning)
Hypervisor/house decreases memory → page in from disk
How are pages shared across VMs? (Oblivious Page Sharing)
- Works on both full and paravirtualized systems
- Hash contents of page on hypervisor
- On new page read, hash and see if it matches a hash already stored
- If hashes match, do a full comparison to see if there are any changes
- If page matches, update page table to remove duplicate values
- If changes are made, mark page as copy on write to update
What are memory allocation policies?
- Pure share based approach
- Working set based approach
- Dynamic idle-adjusted shares approach
- Reclaim most idle memory (tax idle pages more than active pages)