Virtualization and Hypervisors
The machinery behind elastic compute
Hypervisors carve physical servers into isolated virtual machines. Types 1 and 2, hardware-assisted virtualization and container-based alternatives are what make the elastic cloud possible.
What you will learn
- Explain the role of a hypervisor in a VM architecture
- Compare Type 1 and Type 2 hypervisors
- Position containers as an alternative to hardware virtualization
A hypervisor is a thin software layer that lets many isolated operating systems share one physical machine. It is the engine that turns one server into a rack of rented computers.
What is this?
Virtualization lets a hypervisor run multiple isolated virtual machines (VMs) on one physical host, each with its own OS, virtual CPU, memory and disk. Type 1 (bare-metal) hypervisors (KVM, Hyper-V, VMware ESXi, Xen) run directly on hardware and power the public clouds. Type 2 hypervisors (VirtualBox, QEMU-with-KVM userspace) run on an existing OS and are common in dev labs. Containers virtualize the OS layer instead of the machine — shared kernel, isolated processes — trading isolation for density.
Why do you need it?
- Without hypervisors there is no 'on-demand compute': each app would need its own physical server.
- Hardware-assisted CPU features let a VM run at near-native speed, making multi-tenancy practical.
- A hypervisor's isolation boundary is the cloud's core trust primitive — guests must not see each other.
- Understanding the layer explains why 'reboot the VM' sometimes help and sometimes means the host.
Mental model
An apartment building's walls and utility meters
A hypervisor on a host
Everyone lives close together, each unit is sealed from its neighbors, and each pays for its own metered usage — the building (hypervisor) enforces the boundaries and allocates shared infrastructure.
How it works
- The hypervisor owns the host hardware and presents each VM a virtual CPU, memory, disk and network device.
- Privileged operations (IDT, MMU, I/O) are caught and emulated or passed through with hardware assist.
- The hypervisor isolates memory and enforces scheduling, so a crashing guest can't take neighbors down.
- Snapshots and live migration read/write a VM's state — powering backups and host maintenance without downtime.
- Containers skip this isolation, sharing the host kernel with namespace/cgroup sandboxing instead.
Type 1 hypervisor hosting multiple guest VMs.
In production
- Public clouds place thousands of KVM-based VMs on each host rack, live-migrating guests during host patching.
- A DR business keeps legacy OS images as VMs in the cloud, storing snapshots on object storage for replay.
- Dev laptops run VirtualBox (Type 2) for local environments that mirror cloud AMIs.
Best practices
- Size VM families to workload, knowing that a 'large' VM is several physical cores with shared host resources.
- Use snapshots for point-in-time copies, not long-term backups — they live with the host and cost storage.
- Prefer managed machine images over hand-built guest OS so patching and security baselines are reproducible.
- Choose containers for density on controlled workloads and VMs for stricter isolation or legacy images.
Common mistakes
- Assuming a snapshot is a backup — it is a state copy, often on the same failure domain.
- Overcommitting memory/CPU on smaller clouds purely on paper ratios, inviting noisy neighbors.
- Running workloads that need custom kernels in an unsupported virtualization setting.
- Treating 'VM' and 'container' as interchangeable when isolation and security models differ.
Common issues
Guest shows high steal/awkward idle CPUHost CPU heavily overcommitted by other tenants
Move to a less-contended size/family or a dedicated host for latency-critical work.
Snapshots fill the volumeSnapshotting a frequently-written disk grows the change-set continuously
Schedule snapshots around write quiet times and expire them on a lifecycle policy.
Live migration stalls a replicated ringerMemory-write rates exceed migration speed for a large-hot VM
Plan maintenance windows, or use larger instance classes with higher network throughput for migrations.
Debugging tips
- CPU spikes from 'System/Steal' time indicate host-level contention — you're sharing the physical core.
- If a snapshot rollback fails, check you aren't rolling a disk with an active write-heavy workload.
- When live-migration is disabled, host maintenance shows up as instanced reboots — the hypervisor isn't broken.
- 'Balloon' or 'steal' metrics are the correct place to look for noisy-neighbor impact.
Interview checkpoint
Quick quiz
Which hypervisor type powers the public clouds?
A VM snapshot is a safe long-term backup strategy.