Lecture 11 - Virtual Machines Flashcards

1
Q

What is the fundamental idea between virtual machines

A

Fundamental idea – abstract hardware of a single computer into several different execution environments

Similar to layered approach
But layers create virtual system (virtual machine, or VM) on which operating systems or applications can run

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the 3 components of virtual machines?

A
  1. Host – underlying hardware system
  2. Virtual machine manager (VMM) or hypervisor – creates and runs virtual machines by providing interface that is identical to the host
    (Except in the case of paravirtualization)
  3. Guest – process provided with virtual copy of the host
    Usually an operating system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the three types of hypervisors?

A

Type 0 hypervisors - Hardware-based solutions that provide support for virtual machine creation and management via firmware
IBM LPARs and Oracle LDOMs are examples

Type 1 hypervisors - Operating-system-like software built to provide virtualization
Including VMware ESX, Joyent SmartOS, and Citrix XenServer

Type 1 hypervisors – Also includes general-purpose operating systems that provide standard functions as well as VMM functions
Including Microsoft Windows Server with HyperV and RedHat Linux with KVM

Type 2 hypervisors - Applications that run on standard operating systems but provide VMM features to guest operating systems
Including VMware Workstation and Fusion, Parallels Desktop, and Oracle VirtualBox

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define paravirtualization

A

Technique in which the guest operating system is modified to work in cooperation with the VMM to optimize performance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Define Programming-environment virtualization

A

VMMs do not virtualize real hardware but instead create an optimized virtual system
Used by Oracle Java and Microsoft.Net

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Define Emulators

A

Allow applications written for one hardware environment to run on a very different hardware environment, such as a different type of CPU

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Define Application containment

A

Not virtualization at all but rather provides virtualization-like features by segregating applications from the operating system, making them more secure, manageable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Name 6 benefits of VMs

A
  1. Host system protected from VMs, VMs protected from each other
    I.e. A virus less likely to spread
    Sharing is provided though via shared file system volume, network communication
  2. Freeze, suspend, running VM
    Then can move or copy somewhere else and resume
    Snapshot of a given state, able to restore back to that state
    Some VMMs allow multiple snapshots per VM
  3. Clone by creating copy and running both original and copy
    Great for OS research, better system development efficiency
  4. Run multiple, different OSes on a single machine
    Consolidation, app dev, …
  5. Templating – create an OS + application VM, provide it to customers, use it to create multiple instances of that combination
  6. Live migration – move a running VM from one host to another!
    No interruption of user access
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Most VMMs implement ___ to represent state of CPU per guest as guest believes it to be

A

virtual CPU (VCPU)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When guest context switched onto CPU by VMM, information from VCPU __ and __

A

loaded and stored

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are Control-sensitive instructions?

A

Control-sensitive instructions

  • > affect the allocation of resources available to the virtual machine
  • > change processor mode without causing a trap

Ex: Status register

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are Behavior-sensitive instructions

A

Behavior-sensitive instructions

-> effect of execution depends upon location in real memory or on processor mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the essential requirement for virtual machines?

A

A virtual machine is an efficient, isolated duplicate of real machine

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When do privileged instructions cause faults?

When can they be ran?

A

Cause a fault in user mode

Work fine in privileged mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the Popek and Goldberg theorem?

A

For any conventional third-generation computer, a virtual machine monitor may be constructed if the set of sensitive instructions for that computer is a subset of the set of privileged instructions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Where do the virtual user mode and virtual kernel mode reside?

A

in real user mode

17
Q

In vms, actions in guest that usually cause switch to kernel mode must cause switch to ___

A

virtual kernel mode

18
Q

What usually happens when a user runs a sensitive instruction?

A

It gets TRAPed and runs in kernel

19
Q

How does switch from virtual user mode to virtual kernel mode occur?

A

Attempting a privileged instruction in user mode causes an error -> trap
VMM gains control, analyzes error, executes operation as attempted by guest
Returns control to guest in user mode
Known as trap-and-emulate
Most virtualization products use this at least in part

20
Q

But kernel mode privilege mode code runs ___ due to trap-and-emulate

A

slower

21
Q

In the (Real) 360 architecture, what are the execution modes?

A

supervisor and problem (user)

22
Q
In the (Real) 360 architecture
all sensitive instructions are \_\_\_ and traps to \_\_\_
A

privileged instructions

kernel

23
Q

Explain what happens in each case for both User mode and Priviledged mode in Virtual 360.

(1) non-sensitive instruction
(2) errant instruction
(3) sensitive instruction

A

User mode
(1) non-sensitive instruction
executes fine
(2) errant instruction
traps to VMM; VMM causes trap to occur on guest OS
(3) sensitive instruction
traps to VMM; VMM causes trap to occur on guest OS

Priviledged mode
(1) non-sensitive instruction
executes fine
(2) errant instruction
traps to VMM; VMM causes trap to occur on guest OS
(3) sensitive instruction
traps to VMM; VMM verifies and emulates instruction

24
Q

What is the problem with Intelx86 VMs?

A

Not all sensitive instructions are privileged instructions

25
Q

Why was popf a problem in Intelx86 VMs?

A

The behavior in the guest kernel mode was not the same as the behavior in hardware kernel

pops word off stack, setting processor flags according to word’s content
-> sets all flags if in ring 0
including interrupt-disable flag
-> just some of them if in other rings
ignores interrupt-disable flag
26
Q

How can we solve the popf problem with Binary rewriting?

A

Privilege-mode code run via binary translator
-> replaces sensitive instructions with hypercalls
-> translated code is cached
->usually translated just once
VMWare
U.S. patent 6,397,242

27
Q

What are hypercalls used for?

A

Hypercalls are used to replace the sensitive such that the overall behaviour is the same as what we got the real hardware.

28
Q

How does binary translation work in binary rewriting?

A
  • > Code reads native instructions dynamically from guest, on demand, generates native binary code that executes in place of original code
  • > Performance of this method would be poor without optimizations
29
Q

How does intel vanderpool technology work?

A
-> new processor mode
“ring -1”
root mode
other modes are non-root
-> non-VMM OSes must not be written to use root mode!
30
Q

How does paravirtualization work?

A

–> We modify the guest kernel to change all Sensitive instructions replaced with hypervisor calls

–> Virtual machine provides higher-level device interface
guest machine has no device drivers

–> This is much faster

31
Q
Consider a virtual memory
LA - 32 bits
2048 bytes pages
Page table is 8 bytes
How many levels needed in the paging table?
A

4

[ 1 | 8 | 8 | 8 | 11 ]

32
Q

Logical memory that uses segmentation logical address is 32 bits long. Segment selector is 6 bits long. What is the largest segment size

A

[ 6 | 26 ]

2^26 is the largest segment size