Winter Semester 2026–27 · VIT-AP · BACSE106 · Operating Systems · Dr. Krithika L.B

Session 5.5: Virtualization: need, virtual machines, hypervisors, full and para-virtualization

Why we virtualise, how a host, hypervisor and guests fit together, type 0/1/2 hypervisors, trap-and-emulate, binary translation and hardware support, full versus para-virtualization, and live migration.

Module 5 1 hour Theory CO5
← Before
5.4 Protection
Access matrix
You are here
5.5 Virtualization: need, virtual machines, hypervisors, full and para-virtualization
Module 5 · Managing Devices, Security, Protection and Virtualization
Next →
5.6 Containers
Docker

Learning objectives

By the end of this session you should be able to:

  • List the benefits that motivate virtualization.
  • Describe the host–VMM–guest architecture.
  • Compare type 0, type 1 and type 2 hypervisors with examples.
  • Explain trap-and-emulate, binary translation and hardware-assisted virtualization.
  • Distinguish full virtualization from para-virtualization and describe live migration.

Lecture notes

1. Why virtualization?

The idea goes back to IBM's VM/370 (1972): abstract the hardware of a single computer into several execution environments, each believing it has its own machine. Today it is the foundation of cloud computing.

Consolidation

Many lightly loaded servers become VMs on one physical host — fewer machines, less power and space.

Isolation & security

Each guest is protected from the others; a virus in one VM cannot reach another.

Development & testing

Run several OSes (Windows, Linux versions) on one laptop; snapshot and roll back.

Legacy support

Keep old applications running on their old OS on new hardware.

Live migration

Move a running guest to another host for maintenance or load balancing, with no downtime.

Cloud computing

IaaS providers (AWS EC2, Azure, GCP) rent VMs on demand.

2. VM architecture

Three components: the host (underlying hardware), the virtual machine manager (VMM) or hypervisor (creates and runs VMs, providing an interface identical to the host), and the guests (each usually a full operating system).

Non-virtual machine

processes
kernel
hardware

Virtual machines

processes | processes | processes
kernel VM1 | kernel VM2 | kernel VM3
virtual machine manager
hardware

3. Types of hypervisors

Hardware-based — implemented in firmware; the hardware is partitioned among guests (IBM LPARs, Oracle LDOMs). Each guest gets dedicated resources.

Bare-metal — the hypervisor is a small OS-like layer running directly on the hardware, with guests on top. Very efficient; used in data centres.

Guest OS 1Guest OS 2
Type 1 hypervisor
hardware

Examples: VMware ESXi, Citrix XenServer, Microsoft Hyper-V, KVM (turns Linux itself into a type 1 hypervisor).

Hosted — the hypervisor is an application on a normal host OS. Easy to install on a laptop; lower performance because it relies on the host OS.

Guest OS
Type 2 hypervisor (application)other apps
Host OS
hardware

Examples: Oracle VirtualBox, VMware Workstation, Parallels Desktop.

4. How a hypervisor runs a guest kernel

The guest kernel believes it runs in kernel mode, but it actually runs in user mode (Session 1.3) — otherwise it could take over the real machine. So what happens when it executes a privileged instruction?

Trap-and-emulate

A privileged instruction in user mode traps to the VMM, which emulates its effect on the guest's virtual state and returns. Works only if every sensitive instruction traps — not true of classic x86.

Binary translation

VMware's technique for x86: guest kernel code is inspected and the problematic instructions are rewritten into safe equivalent sequences on the fly (with caching). Unmodified guests run at good speed.

Hardware assistance

Intel VT-x and AMD-V add a new CPU mode for the VMM (host vs guest mode) and nested page tables (EPT/NPT), so guests run natively and the hardware traps only what is needed. Used by every modern hypervisor.

5. Virtualization technologies: full virtualization vs para-virtualization

Full virtualizationPara-virtualization
Guest OSUnmodified — it does not know it is virtualisedModified — it knows and cooperates
Privileged operationsTrap-and-emulate, binary translation or hardware assistReplaced by explicit hypercalls to the hypervisor
PerformanceGood (excellent with VT-x/AMD-V)Very good — fewer traps, simpler hypervisor
CompatibilityAny OS (even Windows) runs as isNeeds OS source changes (or paravirtual drivers)
ExamplesVMware ESXi/Workstation, VirtualBox, KVM, Hyper-VXen (original), virtio drivers in KVM guests

Today the line has blurred: hardware-assisted full virtualization runs the CPU, while paravirtual drivers (virtio) make disk and network I/O fast. Related ideas: emulation (running code for a different CPU, e.g. QEMU emulating ARM on x86 — slow) and application containment, the topic of the next session.

6. Live migration

The source VMM connects to the target and gets permission to send a guest.

The target creates a new guest; the source sends all read-only pages, then read–write pages — while the guest keeps running.

Pages the guest modifies are re-sent, repeatedly, until the set of dirty pages is very small.

The source freezes the guest, sends the CPU state and the last dirty pages, and the target starts the guest. Network connections continue — downtime is milliseconds.

VideoBytes

Virtual machines and hypervisors

Video coming soon

Virtual machines and hypervisors

Recorded by Dr. Krithika L.B. Slot m5-hypervisors

Interactive lessons

Work through these in order after the lecture — each one expands a part of the notes with diagrams, hover notes and a quick check.

Lab connection

Check your understanding

Answer each question in your own words first, then reveal the model answer.

Revealed 0
VirtualBox on a Windows laptop: type 1 or type 2?

Type 2 — it runs as an application on the host OS.

Why can't a guest kernel run in real kernel mode?

It could then control the real hardware and the other guests; the VMM must keep control, so the guest runs in user (or guest) mode.

What is a hypercall?

An explicit call from a para-virtualized guest kernel to the hypervisor, replacing a privileged instruction.

Why was classic x86 hard to virtualise with trap-and-emulate?

Some sensitive instructions (e.g. POPF) behave differently in user mode without trapping, so the VMM never got control. Binary translation or VT-x/AMD-V fixed this.

Key takeaways

  • Virtualization gives consolidation, isolation, testing, legacy support, migration and the cloud.
  • Type 0 (firmware), type 1 (bare-metal: ESXi, Hyper-V, KVM, Xen), type 2 (hosted: VirtualBox).
  • Full virtualization runs unmodified guests (trap-and-emulate, binary translation, VT-x); para-virtualization modifies guests to use hypercalls.

Where this leads

A VM virtualises the whole machine, including a full guest kernel. What if applications only needed isolation from each other on one shared kernel? That is OS-level virtualization: containers.

Continue to 5.6 — Containers and Docker →