01_Introduction_to_Virtualization
Introduction to Virtualization
Complete Study Notes for Cloud Computing
Table of Contents
- What is Virtualization?
- Virtualization Classification
- Key Technical Distinctions
- Evolution Timeline
What is Virtualization?
Virtualization is a technology that creates an abstraction layer over physical computer hardware, allowing resources such as processors, memory, storage, and networks to be divided into multiple virtual environments. These environments—known as Virtual Machines (VMs) or Containers—can run their own operating systems and applications as if they were independent physical machines.
Core Benefits
- Resource Optimization: Run multiple workloads on single physical hardware
- Isolation: Separate environments prevent interference between workloads
- Flexibility: Easy provisioning, scaling, and migration of workloads
- Cost Efficiency: Reduced hardware requirements and energy consumption
- High Availability: Enable live migration and disaster recovery
Virtualization Classification
1. Based on Implementation Layer
A. Hardware-Level Virtualization
Full Virtualization (Hardware-Assisted)
- Utilizes CPU extensions: Intel VT-x, AMD-V
- Examples: VMware ESXi, KVM with hardware support
- Guest OS runs completely unmodified
- Binary translation eliminated through hardware support
- Best performance for unmodified guest operating systems
Para-virtualization
- Examples: Xen (classic mode)
- Guest OS kernel modified to use hypercalls instead of privileged instructions
- Better performance than pure software virtualization
- Trade-off: Requires OS modification (less portable)
- Guest is "aware" it's running in a virtualized environment
B. Software-Level Virtualization
Operating System-Level Virtualization (Containers)
- Examples: Docker, LXC, OpenVZ, Podman
- All containers share the host kernel
- Extremely lightweight with fast startup times
- Uses namespaces for process isolation
- Uses cgroups for resource control
Application-Level Virtualization
- Examples: Java Virtual Machine (JVM), .NET CLR, Wine
- Application runs in isolated sandbox
- Provides portable runtime environment
- Wine provides Windows API translation on Linux
2. Based on Architecture Approach
Type-1 Hypervisor (Bare-Metal/Native)
┌───────────────────────────────────────────┐
│ VM 1 VM 2 VM 3 │
│ ┌────┐ ┌────┐ ┌────┐ │
│ │ OS │ │ OS │ │ OS │ │
│ │Apps│ │Apps│ │Apps│ │
│ └────┘ └────┘ └────┘ │
├───────────────────────────────────────────┤
│ Hypervisor (VMM) │
│ Scheduler │ Memory Mgr │ I/O Handler │
├───────────────────────────────────────────┤
│ Physical Hardware │
│ CPU │ Memory │ NIC │ Storage │ GPU │
└───────────────────────────────────────────┘
Key Characteristics:
- Runs directly on hardware (no host OS layer)
- Operates in Ring 0 (highest privilege level)
- Direct management of all hardware resources
- Lower overhead due to minimal abstraction layers
- Production-grade for data centers and cloud infrastructure
Major Type-1 Hypervisors:
| Hypervisor | Architecture | Footprint | Management |
|---|---|---|---|
| VMware ESXi | Microkernel | ~150MB | vCenter |
| Xen | Microkernel | ~1MB | xl/xm/XAPI |
| KVM | Linux-integrated | Kernel module | libvirt/virsh |
| Hyper-V | Microkernel | ~20MB | SCVMM/PowerShell |
Type-2 Hypervisor (Hosted)
┌───────────────────────────────────────────┐
│ VM 1 VM 2 VM 3 │
│ ┌────┐ ┌────┐ ┌────┐ │
│ │ OS │ │ OS │ │ OS │ │
│ │Apps│ │Apps│ │Apps│ │
│ └────┘ └────┘ └────┘ │
├───────────────────────────────────────────┤
│ Hypervisor (User-space application) │
│ VM Manager │ Device Emulation │
├───────────────────────────────────────────┤
│ Host Operating System │
│ (Windows, Linux, macOS) │
├───────────────────────────────────────────┤
│ Physical Hardware │
└───────────────────────────────────────────┘
Key Characteristics:
- Runs as an application on host OS
- Relies on host OS for device drivers
- Higher overhead due to extra OS layer
- Easier installation and management
- Ideal for development and testing environments
Major Type-2 Hypervisors:
| Hypervisor | Host OS | Performance | Use Case |
|---|---|---|---|
| VMware Workstation | Win/Linux | Excellent | Development |
| VirtualBox | Win/Linux/Mac | Good | Testing |
| QEMU (no KVM) | Any | Poor (emulation) | Cross-architecture |
| Parallels | macOS only | Excellent | Mac users |
3. Based on Resource Virtualization
Compute Virtualization
- CPU Virtualization: Hardware-assisted (VT-x/AMD-V), Binary translation, Paravirtualization
- vCPUs mapped to physical CPU cores/threads
- CPU scheduling algorithms manage time-sharing
Memory Virtualization
- Shadow page tables (legacy approach)
- Extended Page Tables (EPT) / Nested Page Tables (NPT) - Hardware-assisted
- Memory ballooning - Dynamic memory reclamation
- Kernel Same-page Merging (KSM) - Deduplication of identical pages
Storage Virtualization
- Virtual disks: QCOW2, VMDK, VHD formats
- Storage pools and volumes
- Thin provisioning - Allocate on demand
- Snapshot and cloning mechanisms
Network Virtualization
- Virtual switches: Linux Bridge, Open vSwitch (OVS)
- Virtual NICs: virtio-net, e1000
- Network namespaces for isolation
- Software-Defined Networking (SDN)
- Tunneling protocols: VXLAN, GRE
4. Based on Isolation Mechanism
Full Isolation (Strong)
- Traditional VMs with separate kernels
- Each VM has complete OS stack
- Hardware-enforced boundaries via CPU virtualization extensions
- Highest security but highest overhead
Namespace Isolation (Lightweight)
Linux Namespaces provide isolation for:
| Namespace | Purpose | Kernel Version |
|---|---|---|
| PID | Process isolation | 2.6.24 (2008) |
| Network | Network stack isolation | 2.6.29 (2009) |
| Mount | Filesystem isolation | 2.4.19 (2002) |
| UTS | Hostname isolation | 2.6.19 (2006) |
| IPC | Inter-process communication | 2.6.19 (2006) |
| User | UID/GID mapping | 3.8 (2013) |
| Cgroup | Control group visibility | 4.6 (2016) |
| Time | Time isolation | 5.6 (2020) |
Hybrid Isolation
- Kata Containers: Combines container speed with VM security
- gVisor: User-space kernel for containers
- Firecracker: MicroVM for serverless workloads
Key Technical Distinctions
Containers vs Virtual Machines
| Aspect | Containers | VMs |
|---|---|---|
| Kernel | Shared with host | Separate per VM |
| Startup Time | Seconds | Minutes |
| Size | Megabytes | Gigabytes |
| Isolation | Namespace-based | Hardware-enforced |
| Density | High (thousands per host) | Low (tens per host) |
| Overhead | Minimal (~1-2%) | Moderate (~5-15%) |
Hardware vs Software Virtualization
| Aspect | Hardware Virtualization | Software Virtualization |
|---|---|---|
| Requirements | CPU extensions (VT-x/AMD-V) | None |
| Method | Hardware trap and emulate | Binary translation |
| Performance | Near-native (95%+) | Slower (70-90%) |
| Guest OS | Unmodified | May need modification |
| Use Case | Production workloads | Cross-architecture emulation |
Evolution Timeline
1998: VMware founded (first x86 virtualization)
2003: Xen hypervisor released
2005: Intel VT-x introduced
2006: AMD-V introduced, Intel VT-d (IOMMU)
2007: KVM merged into Linux kernel 2.6.20
2008: Intel EPT, AMD NPT (memory virtualization)
2008: cgroups v1 merged into kernel
2010: SR-IOV widespread adoption
2013: Docker released (container revolution)
2014: Kubernetes released by Google
2015: NVIDIA vGPU for GPU virtualization
2016: cgroups v2 in kernel 4.5
2017: AMD SEV (encrypted virtualization)
AWS Nitro System (KVM-based)
2018: Firecracker released by AWS
2020: Intel TDX announced
2021: DPU/SmartNIC mainstream adoption
Summary
Virtualization forms the foundation of modern cloud computing, enabling:
- Multi-tenancy: Multiple customers sharing physical infrastructure
- Elasticity: Dynamic resource allocation
- Portability: Workloads can move between physical hosts
- Efficiency: Better hardware utilization
The choice of virtualization technology depends on:
- Security requirements: Full VMs for strong isolation
- Performance needs: Containers for minimal overhead
- Workload characteristics: Stateless vs stateful
- Operational constraints: Skill sets, tooling, ecosystem
Continue to: 02HardwareBasedVirtualization.md