A student runs Oracle VirtualBox on a Windows laptop to boot Linux in a window. Which description fits this setup?
AA Type 1 hypervisor, because it runs a full operating system
BA Type 2 hypervisor, because it runs as an application on a host operating system
CA container, because both systems share one kernel
DA paravirtualized system, because Linux must be modified
VirtualBox is a hosted (Type 2) hypervisor: Windows is the host OS and VirtualBox runs on top of it. A Type 1 (bare-metal) hypervisor, such as VMware ESXi or Xen, runs directly on the hardware without a general-purpose host OS beneath it.
Question 2 Multiple Choice
Under the classic trap-and-emulate approach, what happens when a guest kernel, running in a less privileged CPU mode, executes a privileged instruction such as one that disables interrupts?
AThe instruction runs on the real CPU and disables interrupts for the whole machine
BThe CPU traps to the hypervisor, which applies the effect to the virtual machine's state only
CThe guest kernel crashes, because guests cannot use privileged instructions
DThe instruction is silently ignored
The hypervisor runs the guest kernel without full privilege. A privileged instruction therefore causes a trap into the hypervisor, which emulates its effect on the VM's virtual CPU, for example marking that VM's virtual interrupts as disabled, and then resumes the guest.
Question 3 True / False
Each Linux container on a host runs its own separate operating system kernel, just as each virtual machine does.
TTrue
FFalse
Answer: False
Containers share the host kernel. The kernel gives each container its own view of processes, files and network (namespaces) and limits its resource use (cgroups). This makes containers start faster and use less memory than VMs, but they offer a weaker isolation boundary and cannot run a different kernel.
Question 4 Short Answer
In 1974, Popek and Goldberg gave a condition for building an efficient trap-and-emulate hypervisor. The original 32-bit x86 architecture did not meet it. State the condition and explain why x86 failed it.
Think about your answer, then reveal below.
Model answer: The set of sensitive instructions (those that read or change privileged machine state) must be a subset of the privileged instructions, so that every sensitive instruction traps when run outside kernel mode. Original x86 had sensitive instructions that did not trap in user mode; they behaved differently or failed silently, so a hypervisor could not catch them.
Designers worked around this with binary translation (rewriting problem instructions, as early VMware did) and paravirtualization (modifying the guest, as Xen did). Hardware support added in the mid-2000s, Intel VT-x and AMD-V, introduced a new CPU mode that makes trap-and-emulate work on x86.