1. Gyanastra
  2. Operating Systems
  3. UGC NET: Virtual Machines
  4. Virtualization Benefits and Techniques
Free lesson, no account needed 11 min read 28 practice questions after it
Asked in past papers1 time
  • ISRO2023

Operating Systems · UGC NET: Virtual Machines

Virtualization Benefits and Techniques

Overview

Virtualization is the creation of a virtual version of a computing resource, such as a CPU, memory, storage, network, or a complete machine, so that multiple isolated execution environments can share one physical system.
In operating-systems terms, a virtual machine monitor (VMM) or hypervisor controls the physical hardware and presents one or more virtual machines (VMs) to guest operating systems.
This topic belongs to System Software and OS Extras under Virtual Machines and depends on earlier ideas of CPU privilege levels, traps, page tables, memory translation, I/O control, and process isolation.
The exam expects both conceptual understanding and small numerical reasoning about memory allocation, live migration, and overcommitment.

Key concepts

  • Host: the physical machine and, for hosted virtualization, the operating system on which the virtualization software runs. Guest: the operating system and applications running inside a VM.
  • Hypervisor / VMM: software or firmware that multiplexes physical resources among VMs and enforces isolation.
  • Type 1 hypervisor: runs directly on bare hardware, with no underlying host OS, e.g. VMware ESXi, Xen, Hyper-V, KVM in common textbook classification.
    Type 2 hypervisor: runs as an application on a host OS, e.g. VirtualBox, VMware Workstation.
  • Full virtualization: the guest OS is unmodified and is presented with complete virtual hardware. It may be implemented by binary translation or hardware-assisted virtualization.
  • Paravirtualization: the guest OS is modified to know it runs under a hypervisor and uses hypercalls for privileged operations. Performance overhead can be lower, but guest compatibility is reduced.
  • Trap-and-emulate: the guest runs in a less-privileged mode; a privileged instruction executed by the guest traps to the hypervisor, which emulates it and resumes the guest.
  • Popek and Goldberg requirements for classical virtualizability: equivalence, performance, and safety; functionally, every sensitive instruction must be privileged so that it traps.
    Innocuous instructions should execute natively.
  • Hardware-assisted virtualization: Intel VT-x and AMD-V add CPU execution modes for hypervisors, so privileged guest operations cause VM exits to the VMM rather than requiring binary translation for every sensitive instruction.
  • Shadow page tables: the hypervisor maintains page tables mapping guest virtual addresses directly to host physical addresses; guest page-table updates are trapped and validated.
  • Nested paging / EPT / NPT: hardware performs two-level translation, guest virtual to guest physical, then guest physical to host physical, reducing VM exits.
  • Memory overcommitment: configured VM memory may exceed physical RAM because not all allocated pages are simultaneously active.
    Ballooning lets a cooperative guest driver release pages to the hypervisor; copy-on-write page sharing deduplicates identical pages until a write occurs.
  • Live migration: moving a running VM to another host with minimal downtime. Snapshot: a point-in-time state of VM disk or memory, often using copy-on-write deltas.
  • Container: OS-level virtualization that shares the host kernel and uses namespaces and cgroups for isolation, giving higher density but weaker kernel isolation than a conventional VM.
  • Benefits of virtualization include higher hardware utilization, server consolidation, lower power and cooling, isolation, rapid provisioning, testing, legacy support, disaster recovery, snapshots, and live migration.
    Costs include CPU virtualization overhead, memory-translation overhead, I/O overhead, management complexity, and security exposure.

How it works

  1. Trap-and-emulate execution. The hypervisor runs a guest OS in a non-privileged or guest CPU mode.
    When the guest executes a privileged instruction such as changing page tables or disabling interrupts, the CPU traps to the hypervisor.
    The hypervisor checks the operation, emulates it on virtual hardware, updates virtual CPU state, and returns to the guest.
    This works cleanly only when sensitive instructions are privileged; otherwise the guest could perform an unsafe operation without trapping.
  2. Binary translation. The hypervisor scans guest kernel code, replaces problematic sensitive instructions with safe emulation or hypercalls, caches translated blocks, and executes the rest natively.
    The guest remains unmodified, but translation and cache management add overhead.
  3. Paravirtualization. The guest OS is modified to issue hypercalls for privileged operations instead of executing instructions that must be trapped. This avoids many trap-and-emulate costs but requires a modified guest.
  4. Hardware-assisted virtualization. The CPU provides a hypervisor mode and guest mode. The guest runs in guest mode; privileged operations cause VM exits to the hypervisor, and the hypervisor resumes the guest with a VM entry.
    This reduces the need for binary translation for privileged instructions.
  5. Memory translation. The guest uses guest virtual addresses mapped to guest physical addresses.
    In shadow paging, the hypervisor maintains a shadow table mapping guest virtual directly to host physical; guest page-table writes are trapped.
    In nested paging, hardware walks the guest page table and then a nested host page table, reducing exits.
  6. Live migration. The source hypervisor copies VM memory to the destination while the VM runs. Modified dirty pages are recopied iteratively.
    When the remaining dirty set is small, the VM is briefly paused, final state is copied, and execution resumes on the destination. Pre-copy converges only when the dirty-page rate is less than the migration link throughput.
  7. Memory overcommitment. The hypervisor does not necessarily back every configured guest page with physical RAM immediately.
    Ballooning asks a cooperative guest to release pages; page sharing merges identical pages using copy-on-write; swapping may handle pressure.
    This raises density but risks performance degradation if working sets exceed physical memory.
Figure. Notice that Type 1 hypervisors sit directly on physical hardware, while Type 2 hypervisors run on a host operating system. Both arrangements host guest VMs, whose guest OSes run applications.

Formulas

  • Let HH be usable host RAM, RR the hypervisor reservation, and MM the configured memory per VM, all in the same unit. With no overcommitment:

Nmax⁡=⌊H−RM⌋N_{\max}=\left\lfloor\frac{H-R}{M}\right\rfloor

  • With overcommitment, configured memory may satisfy ∑Ci+R>H\sum C_i + R > H, but steady-state feasibility requires working sets to satisfy:

∑Wi+R≤H\sum W_i + R \le H

  • where CiC_i is configured memory and WiW_i is actual working-set memory of VM ii.

  • For pre-copy live migration, let MM be total memory to transfer in MB, BB the copy bandwidth in MB/s, and DD the dirty-page generation rate in MB/s. Pre-copy converges if D<BD<B. Ignoring stop-and-copy threshold and setup time:

Tcopy=MB−DT_{\text{copy}}=\frac{M}{B-D}

  • If the remaining dirty memory at stop time is SS MB, approximate downtime is:

Tdown≈SBT_{\text{down}}\approx\frac{S}{B}

Worked examples

Example 1: memory capacity. Geeta has a host with 48 GB usable RAM. The hypervisor reserves 6 GB and each VM is configured with 7 GB with no overcommitment. Compute the maximum number of VMs.
Available for VMs =48−6=42=48-6=42 GB. Number =⌊42/7⌋=6=\lfloor42/7\rfloor=6. Check: 6×7+6=486\times7+6=48 GB exactly. Seven VMs would need 7×7+6=557\times7+6=55 GB, which exceeds 48 GB. Answer: 6 VMs.

Example 2: hypervisor type. Ramesh installs VMware Workstation on an Ubuntu laptop and runs a Windows guest VM. Identify the hypervisor type and explain where privileged guest operations are handled.
VMware Workstation is a Type 2 hosted hypervisor because it runs as an application on the host OS. A privileged guest instruction traps to the hypervisor, which emulates the virtual hardware operation; physical device access ultimately goes through the host OS. Answer: Type 2 hypervisor above the host OS.

Example 3: live migration. Ankur migrates a VM with 6 GB memory. The link gives 600 MB/s copy throughput and the VM dirties pages at 400 MB/s. Convert 6 GB to 6144 MB. Is convergence possible, what is the pre-copy time, and what is downtime if the final residual is 240 MB?
Convergence requires D<BD<B: 400<600400<600, so yes. Initial copy time =6144/600=10.24=6144/600=10.24 s. During it, dirty pages generated =400×10.24=4096=400\times10.24=4096 MB. Iterative total time =M/(B−D)=6144/(600−400)=6144/200=30.72=M/(B-D)=6144/(600-400)=6144/200=30.72 s. Final downtime for 240 MB =240/600=0.4=240/600=0.4 s plus state-transfer overhead.
Answer: converges; about 30.72 s pre-copy; about 0.4 s final downtime.

Example 4: statement type. Consider: I. Innocuous instructions should execute natively without hypervisor intervention. II. For classical trap-and-emulate, sensitive instructions must be privileged. III. Paravirtualization requires no change to the guest OS.
I is true by the Popek–Goldberg performance requirement. II is true; otherwise sensitive operations may not trap. III is false; paravirtualization modifies the guest to use hypercalls. Answer: I and II true, III false.

Example 5: match type. Match: A. Full virtualization, B. Paravirtualization, C. Shadow page tables, D. Live migration.
Descriptions: i. unmodified guest with virtual hardware; ii. modified guest using hypercalls; iii. hypervisor maps guest virtual directly to host physical; iv. transfer a running VM to another host.
Answer: A–i, B–ii, C–iii, D–iv.

Comparison

FeatureType 1 hypervisorType 2 hypervisor
PositionDirectly on hardwareAs an application on a host OS
Host OSNot requiredRequired
PerformanceGenerally higher, especially for serversLower for I/O-heavy guests due to extra layer
Typical useData centres, serversDesktops, testing, development
ExamplesVMware ESXi, Xen, Hyper-V, KVM commonly classified Type 1VirtualBox, VMware Workstation
TechniqueGuest modified?Main mechanismMain trade-off
Trap-and-emulateNoPrivileged instruction traps to hypervisorNeeds sensitive instructions privileged
Binary translationNoRewrites sensitive instructions dynamicallyTranslation and cache overhead
ParavirtualizationYesHypercallsBetter efficiency but less compatibility
Hardware-assistedNoCPU guest mode and VM exitsHardware dependency; memory/I/O still virtualized
PointShadow page tablesNested paging / EPT / NPT
MappingGuest virtual to host physical via shadow tableGuest virtual to guest physical, then host physical
Maintained byHypervisor softwareCPU hardware with hypervisor setup
Guest page-table writesTrapped and emulatedGenerally not trapped for mapping itself
VM exitsMoreFewer
RequirementWorks on older CPUsRequires hardware support
PointConventional VMContainer
KernelSeparate guest kernelShares host kernel
IsolationStrong hardware-level isolationProcess-level isolation via namespaces and cgroups
StartupSlower, full OS bootFast
DensityLowerHigher
Best useDifferent OSes, strong isolationMany similar services on one kernel

Revision summary

  • Host is physical; guest is virtual. Hypervisor/VMM controls resources.
  • Type 1 = bare metal; Type 2 = hosted application.
  • Classical trap-and-emulate needs sensitive instructions to be privileged.
  • Paravirtualization modifies the guest and uses hypercalls.
  • Binary translation rewrites sensitive guest instructions; guest remains unmodified.
  • Shadow page tables are software-made direct guest-virtual-to-host-physical maps; nested paging is hardware two-level translation.
  • No overcommit: Nmax⁡=⌊(H−R)/M⌋N_{\max}=\lfloor(H-R)/M\rfloor.
  • Live migration pre-copy converges only if dirty rate DD < link bandwidth BB.
  • Ballooning reclaims guest memory cooperatively; copy-on-write sharing deduplicates pages.
  • Snapshot is point-in-time state; live migration moves a running VM.
  • Containers share the host kernel, so density is higher but kernel-level isolation is weaker.

Previous-year exam insights

  • Direct concept questions ask the definition of host, guest, Type 1 vs Type 2 hypervisor, and the primary benefit of server virtualization, especially consolidation and reduced power/cooling.
  • Trap-and-emulate questions ask the exact sequence: guest executes privileged instruction, traps to hypervisor, hypervisor emulates, guest resumes.
  • Technique-matching questions mix trap-and-emulate, shadow page tables, ballooning, hypercalls, VM exits, snapshots, live migration, and copy-on-write sharing.
  • Statement questions test whether paravirtualization needs a modified guest, whether hardware-assisted virtualization adds CPU modes, and whether innocuous instructions run natively.
  • Assertion–reason questions often contrast benefits with overhead: virtualization improves utilization but adds CPU, memory, and I/O overhead because resources are shared.
  • Numeric questions use Nmax⁡=⌊(H−R)/M⌋N_{\max}=\lfloor(H-R)/M\rfloor and live-migration convergence condition D<BD<B; check units, especially GB to MB conversion.
  • Common traps: confusing shadow page tables with nested paging, calling containers “VMs”, assuming live migration always converges, and forgetting the hypervisor memory reservation.
  • Check first: host/guest terminology, which layer performs the action, whether the guest is modified, and whether the question asks for a benefit or a mechanism.

Practice at PARIKSHA

You are ready for the PARIKSHA tests of this sub-topic when you can:

  • define host, guest, hypervisor, Type 1, and Type 2 without confusion;
  • explain trap-and-emulate step by step and state the Popek–Goldberg sensitive-instruction condition;
  • distinguish full virtualization, binary translation, paravirtualization, and hardware-assisted virtualization;
  • compare shadow page tables with nested paging and explain why nested paging reduces VM exits;
  • explain ballooning, memory overcommitment, and copy-on-write page sharing in one sentence each;
  • compute the maximum number of VMs from host RAM, hypervisor reservation, and per-VM memory;
  • decide whether live migration converges from dirty rate and link bandwidth, and compute approximate transfer time;
  • match techniques such as snapshot, live migration, hypercall, VM exit, and ballooning to their functions;
  • distinguish a conventional VM from a container using kernel sharing, isolation, startup, and density;
  • identify the benefit and the overhead side of virtualization in assertion–reason questions.

Attempt the sub-topic test first, then the subject test.

Pages 1–2 of 2