4.2.40 · D3Operating Systems

Worked examples — Virtualization — type 1 and type 2 hypervisors

4,033 words18 min readBack to topic

The scenario matrix

Think of every problem this topic can throw as living in one of these cells. Each cell is a "sign" or "edge case" — just like a trig problem lives in a particular quadrant.

Cell Case class The twist it tests
C1 Pure Type 1 (boots the metal) No OS underneath — recognise "installed on blank hardware"
C2 Pure Type 2 (app on a host) An existing OS owns the hardware first
C3 Hybrid / degenerate (KVM) The host OS becomes the hypervisor — is it 1 or 2?
C4 Zero-guest / limiting case Hypervisor running but no VM booted yet — overhead = ?
C5 Emulator, NOT a hypervisor "Virtual" word-trap: full instruction simulation
C6 Nested virtualization A hypervisor running inside a VM — counting layers
C7 Quantitative overhead Compute the latency penalty from layer crossings
C8 Real-world word problem Pick a type from business constraints (cost, security)
C9 Exam-style twist Popek–Goldberg / non-trapping instruction reasoning
C10 Paravirtualization Guest modified to call the hypervisor by explicit hypercalls

Below, every cell gets at least one fully worked example.


First, SEE the layer crossings

Almost every example on this page boils down to counting layer crossings, so let's draw them before we count them. In the figure below, follow a single hardware request (the arrows) as it travels downward from a guest to the silicon. Each arrow that steps from one software box to the next is one crossing.

Figure — Virtualization — type 1 and type 2 hypervisors

C1 · Pure Type 1 — boots the bare metal


C2 · Pure Type 2 — an app on a host OS


C3 · Hybrid / degenerate — the KVM trick


C4 · The limiting case — hypervisor with zero guests


C5 · The word-trap — emulator is NOT a hypervisor


C6 · Nested virtualization — counting layers carefully


C7 · Quantitative overhead — computing the penalty


C8 · Real-world word problem — choose the type


C9 · Exam-style twist — Popek–Goldberg reasoning


C10 · Paravirtualization — the guest asks nicely


One decision tree that replays every example

Now that you have worked all cells, here is the single flowchart your brain should run on any new scenario. Walk it once with Example 2 in hand: "What boots the metal?" → a normal OS (Windows) → Type 2. Now walk it with Example 1: → the hypervisor (ESXi) → Type 1. Example 3 (KVM): → a kernel module → Hybrid. And the second branch catches Example 5: the ARM-on-x86 guest fails "same ISA + direct execution", so it drops out as an emulator, never a hypervisor.

the hypervisor

a normal OS

kernel module

no cross ISA

yes

A hypervisor scenario

What boots the metal

Type 1 bare metal one layer Ex1

Type 2 hosted two layers Ex2

Hybrid KVM effectively Type 1 Ex3

Same CPU ISA and direct execution

Emulator not a hypervisor Ex5

Is the guest modified to make hypercalls

Paravirtualization Ex11


Matrix coverage check

Recall Did we hit every cell?

C1 → Ex 1 · C2 → Ex 2 · C3 → Ex 3 · C4 → Ex 4 · C5 → Ex 5 · C6 → Ex 6 · C7 → Ex 7 & 8 · C8 → Ex 9 · C9 → Ex 10 · C10 → Ex 11. Every cell covered. ✓


Active recall

Which cell does "ESXi on a blank server" belong to, and what type?
Cell C1 — Type 1 (boots the metal, 1 layer).
VirtualBox on Windows: type and layer count?
Type 2, 2 layers (guest → VirtualBox → Windows → hardware).
Why is KVM effectively Type 1?
The kernel module makes the Linux kernel itself the hypervisor — host OS and VMM are the same privileged layer (a hybrid/degenerate collapse).
With and , how much slower is Type 2 than Type 1?
.
Cross-ISA QEMU (ARM guest on x86): hypervisor or emulator?
Emulator — no guest instruction runs natively, so it simulates the whole CPU.
As crossing cost , the Type-2/Type-1 ratio approaches?
1 (near-native), which is why hardware-assisted Type 2 isn't "always slow".
What is paravirtualization, and does it change the Type 1/2 classification?
The guest is modified to call the hypervisor via explicit hypercalls; it changes the guest–hypervisor interface, NOT where the hypervisor sits, so it does not change Type 1 vs 2.