Virtualization
Virtualization is a technology that allows one physical computer to create and run multiple virtual computers or virtual environments using software.
Each virtual machine can behave like an independent computer with its own:
- Operating system
- CPU allocation
- Memory
- Disk
- Network interface
- Applications
Exam definition
Virtualization is a technology that creates virtual versions of computing resources such as computers, operating systems, storage, networks, or hardware using a software layer called a hypervisor.
1. Basic Idea
Without virtualization:
Physical Computer │ ↓ Windows │ ↓ Applications
With virtualization:
Physical Computer │ Hypervisor ┌──────────┼──────────┐ ↓ ↓ ↓ VM 1 VM 2 VM 3 ↓ ↓ ↓ Linux Windows Linux
So one physical machine can run multiple operating systems.
2. Why Virtualization is Needed
Suppose you have one powerful computer:
CPU = 16 cores RAM = 32 GB SSD = 1 TB
Instead of using it only for one OS:
Computer ↓ Windows
you could create:
Computer ↓ Hypervisor ┌──────┼──────┐ ↓ ↓ ↓ Win11 Kali Ubuntu 8GB 8GB 8GB
The remaining resources can be used by the host and other workloads.
3. Hypervisor
The most important component of virtualization is the:
Hypervisor
A hypervisor creates and manages virtual machines.
It controls access to:
- CPU
- RAM
- storage
- networking
- virtual devices
Architecture:
Applications ↓ Guest OS ↓ Virtual Hardware ↓ Hypervisor ↓ Physical Hardware
4. Types of Hypervisors
There are two major types:
Type 1 Type 2
5. Type 1 Hypervisor
Type 1 is also called:
Bare-metal hypervisor
It runs directly on physical hardware.
┌──────────────────────────┐ │ VM 1 │ │ Guest OS │ ├──────────────────────────┤ │ VM 2 │ │ Guest OS │ ├──────────────────────────┤ │ VM 3 │ │ Guest OS │ ├──────────────────────────┤ │ Type 1 Hypervisor │ ├──────────────────────────┤ │ Physical Hardware │ └──────────────────────────┘
Examples include:
- VMware ESXi
- Microsoft Hyper-V in server/bare-metal deployments
- Xen
- KVM-based virtualization platforms
Advantages
- High performance
- Strong isolation
- Suitable for servers
- Efficient resource management
Common use
Data Centers Servers Cloud Computing Enterprise Infrastructure
6. Type 2 Hypervisor
Type 2 is also called:
Hosted hypervisor
It runs as an application on an existing operating system.
┌──────────────────────────┐ │ VM 1 │ │ Linux │ ├──────────────────────────┤ │ VM 2 │ │ Windows │ ├──────────────────────────┤ │ Type 2 Hypervisor │ ├──────────────────────────┤ │ Host OS │ ├──────────────────────────┤ │ Physical Hardware │ └──────────────────────────┘
Examples:
- Oracle VirtualBox
- VMware Workstation/Fusion
- Parallels Desktop
Advantages
- Easy to install
- Good for learning
- Good for development/testing
- Runs on normal desktop OS
Disadvantage
There is additional software overhead compared with a direct bare-metal design.
7. Type 1 vs Type 2
| Feature | Type 1 | Type 2 |
|---|---|---|
| Name | Bare-metal | Hosted |
| Runs on | Hardware | Host OS |
| Performance | Generally higher | Generally lower |
| Typical use | Servers/data centers | Desktop/testing |
| Isolation | Strong | Depends on host/hypervisor |
| Example | ESXi, Xen | VirtualBox, VMware Workstation |
Memory trick
Type 1 → Hardware first
Type 2 → Host OS first
8. Host OS and Guest OS
Host OS
The operating system running on the physical machine.
Guest OS
The operating system running inside a virtual machine.
Example:
Physical Laptop ↓ Windows 11 Host OS ↓ VirtualBox ↓ Kali Linux Guest OS
Here:
Windows → Host Kali → Guest VirtualBox → Hypervisor
9. Virtual Machine
A Virtual Machine (VM) is a software-defined computer.
A VM can have:
Virtual CPU Virtual RAM Virtual Disk Virtual NIC Virtual USB Virtual Display
Example:
Physical PC │ Hypervisor │ ┌────────────┴────────────┐ ↓ ↓ Kali Linux Windows │ │ vCPU: 4 vCPU: 4 RAM: 8GB RAM: 8GB Disk: 50GB Disk: 80GB
10. Virtual CPU
A VM receives virtual CPUs, often called:
vCPU
The hypervisor schedules virtual CPU execution onto physical CPU cores/threads.
VM ↓ vCPU ↓ Hypervisor ↓ Physical CPU
A vCPU does not necessarily mean a permanently dedicated physical core.
11. Virtual Memory
A VM gets virtual memory allocated by the hypervisor.
Example:
Physical RAM = 32 GB VM 1 → 8 GB VM 2 → 8 GB VM 3 → 4 GB Host/others → remaining
There are multiple layers of address translation in virtualized systems.
Simplified:
Guest Virtual Address ↓ Guest OS Page Tables ↓ Guest Physical Address ↓ Hypervisor / Hardware Translation ↓ Machine Physical Address
Modern CPUs provide hardware virtualization features to make this efficient.
12. Virtual Disk
A VM normally sees a virtual disk.
Example:
Kali VM ↓ virtual_disk.vdi
or other virtual disk formats.
The file may exist on the host's physical SSD.
Physical SSD ↓ VM disk file ↓ Guest virtual disk ↓ Guest filesystem
Common virtual disk formats include:
- VDI
- VMDK
- VHD/VHDX
- QCOW2
13. Virtual Network Adapter
A VM can have a virtual network interface.
Guest OS ↓ Virtual NIC ↓ Hypervisor ↓ Physical NIC ↓ Network
The guest OS thinks it has a normal network adapter.
14. Virtualization Networking
Common VM networking modes include:
NAT
VM accesses external network through the host.
VM ↓ Hypervisor ↓ Host ↓ Internet
Bridged
VM appears as another device on the physical network.
Router ├── Host └── VM
Host-only
VM communicates with the host and/or other host-only VMs, but normally not directly with the external network.
15. Full Virtualization
In full virtualization, the guest OS runs in a virtual hardware environment without needing to be specially modified for the hypervisor.
Conceptually:
Guest OS ↓ Virtual Hardware ↓ Hypervisor ↓ Physical Hardware
The guest OS behaves as though it has its own computer.
16. Hardware-Assisted Virtualization
Modern CPUs provide virtualization extensions.
Examples:
Intel
Intel VT-x
AMD
AMD-V
These technologies help processors efficiently run virtual machines.
Modern virtualization also uses mechanisms for memory virtualization and I/O virtualization.
17. Virtualization and Privilege Levels
Traditional CPUs have privilege levels.
Virtualization adds mechanisms allowing a hypervisor to control guest operating systems.
Conceptually:
Guest Applications ↓ Guest Kernel ↓ Virtualization layer ↓ Hypervisor ↓ Hardware
The hypervisor prevents one VM from directly interfering with another VM or the host.
18. VM Isolation
One major benefit is isolation.
Example:
┌───────────────┐ │ VM 1 │ │ Linux │ └───────┬───────┘ │ Hypervisor │ ┌───────┴───────┐ │ VM 2 │ │ Windows │ └───────────────┘
A problem inside VM 1 generally should not directly corrupt VM 2's operating system.
However, virtualization is not an absolute security boundary. Hypervisor vulnerabilities, misconfiguration, shared resources, and VM escape attacks can create risks.
19. VM Snapshot
A snapshot captures the state/configuration of a VM at a particular point.
Example:
Working VM ↓ Snapshot ↓ Install/test something ↓ Problem ↓ Revert ↓ Earlier VM state
Very useful for:
- testing
- labs
- malware analysis in controlled environments
- software development
- OS experiments
Snapshots are not the same as backups.
20. Cloning
A VM can be cloned to create another VM based on an existing one.
Original VM │ ├── Clone 1 ├── Clone 2 └── Clone 3
Useful for:
- testing
- labs
- development environments
- server deployment
21. Virtual Machine Migration
A VM can sometimes be moved from one physical host to another.
Physical Host A │ │ VM ↓ Physical Host B
This can be:
Cold migration
VM is stopped before moving.
Live migration
VM continues running while its state is transferred, with only a brief interruption depending on the platform/workload.
Common in data centers.
22. Server Virtualization
Instead of:
Server 1 → Application A Server 2 → Application B Server 3 → Application C
virtualization can provide:
Physical Server ↓ Hypervisor ┌──────┼──────┐ ↓ ↓ ↓ VM1 VM2 VM3 ↓ ↓ ↓ App A App B App C
This can improve hardware utilization.
23. Desktop Virtualization
Example:
Windows Host ↓ VirtualBox ↓ Kali Linux VM
This is particularly useful for learning different operating systems without replacing the host OS.
24. Cloud Virtualization
Cloud providers use virtualization extensively to provide computing resources.
Conceptually:
Physical Data Center ↓ Hypervisor / Virtualization ↓ VMs ↓ Cloud Services
A user may request:
4 vCPU 8 GB RAM 100 GB storage
without knowing which physical server ultimately runs the workload.
25. Virtualization in Cloud Computing
Benefits include:
- resource pooling
- isolation
- scalability
- flexible allocation
- server consolidation
- easier deployment
- migration
- automation
26. Storage Virtualization
Storage virtualization abstracts physical storage into logical storage resources.
HDD 1 ─┐ HDD 2 ─┼──→ Storage Layer ──→ Logical Volume SSD 1 ─┘
Examples include:
- virtual disks
- storage pools
- logical volumes
- software-defined storage
27. Network Virtualization
Network virtualization creates logical networking resources independent of physical network hardware.
Examples:
- virtual switches
- virtual network interfaces
- VLANs
- VPNs
- virtual routers
Conceptually:
Physical NIC ↓ Virtual Switch ┌───┼───┐ ↓ ↓ ↓ VM1 VM2 VM3
28. Hardware Virtualization
Hardware resources are presented to guest systems as virtual devices.
Examples:
Virtual CPU Virtual RAM Virtual NIC Virtual Disk Virtual USB Controller Virtual Display
29. OS-Level Virtualization
This is different from traditional VMs.
Instead of running a complete guest kernel:
Traditional VM: VM ↓ Guest OS ↓ Hypervisor ↓ Hardware
OS-level virtualization:
Containers ↓ Host OS Kernel ↓ Hardware
Examples:
- Docker containers
- LXC
- Podman containers
This leads directly to your next topic: Containers.
30. Virtualization vs Containerization
| Feature | Virtual Machine | Container |
|---|---|---|
| Virtualizes | Hardware/system | OS-level environment |
| Guest kernel | Usually yes | Shares host kernel |
| Size | Usually larger | Usually smaller |
| Startup | Usually slower | Usually faster |
| Isolation | Strong | Process-level isolation |
| Resource overhead | Higher | Lower |
| Example | VirtualBox VM | Docker container |
Memory trick:
VM = Virtual Computer
Container = Isolated Application Environment
31. Virtualization vs Emulation
These are often confused.
Virtualization
The guest architecture is compatible with the host CPU architecture and hardware assistance can be used.
x86 host ↓ x86 VM
Emulation
Software imitates a different hardware architecture.
x86 host ↓ Emulator ↓ ARM environment
Emulation can be significantly slower because instructions may need to be translated or interpreted.
32. Virtualization vs Dual Boot
Virtualization
Computer ↓ Host OS ↓ VM ↓ Guest OS
Both systems can run at the same time.
Dual Boot
Computer ↓ Bootloader ├── Windows └── Linux
You choose one OS during boot.
| Feature | Virtualization | Dual Boot |
|---|---|---|
| Run simultaneously | Yes | No |
| Performance | Some overhead | Near-native |
| Switching | Easy | Requires reboot |
| RAM sharing | Yes | One OS at a time |
| Setup | VM software | Disk/boot configuration |
33. Advantages of Virtualization
1. Server consolidation
Multiple workloads can run on one physical machine.
2. Better resource utilization
Instead of leaving hardware idle:
Before: CPU utilization → low After: Multiple VMs → higher utilization
3. Isolation
VMs are separated from each other.
4. Testing
You can test:
- Linux
- Windows
- applications
- configurations
without changing the main OS.
5. Snapshots
Easy rollback during testing.
6. Migration
VMs can sometimes be moved between physical hosts.
7. Disaster recovery
VM images can simplify restoration and replication.
34. Disadvantages
1. Resource overhead
VMs consume:
- RAM
- CPU
- storage
2. Performance overhead
Some workloads may perform slower than directly on physical hardware.
3. Complexity
Large virtual environments require careful management.
4. Single-host failure
If many VMs depend on one physical server and it fails, many workloads may be affected.
5. Security risks
Hypervisor vulnerabilities and misconfiguration can affect isolation.
35. Virtualization Security
Important security concepts:
VM isolation
Prevent one VM from accessing another's resources.
Hypervisor security
Keep the hypervisor patched and securely configured.
Network isolation
Use:
- VLANs
- virtual networks
- firewalls
- security groups
Access control
Limit who can:
- create VMs
- modify VMs
- access snapshots
- attach storage
- manage the hypervisor
36. Virtualization in Cybersecurity
Virtualization is extremely useful for security labs.
Example:
Physical PC ↓ VMware / VirtualBox ↓ ┌─────────────┬──────────────┐ │ Kali Linux │ Windows VM │ │ │ │ │ Security │ Test Target │ │ Tools │ Application │ └─────────────┴──────────────┘
You can create an isolated lab for learning:
- networking
- Linux
- Windows administration
- web security
- malware analysis in controlled environments
- penetration-testing concepts
Always isolate intentionally vulnerable test systems from networks you do not own or have permission to test.
37. Virtualization in IoT
Virtualization is also useful around IoT development.
For example:
Physical PC ↓ Linux VM ↓ MQTT Broker ↓ IoT devices
You could run:
- Ubuntu Server
- MQTT broker
- database
- web dashboard
- development tools
inside VMs.
However, tiny microcontrollers such as an ESP32 generally do not run traditional VMs like a desktop computer does.
38. Important Virtualization Technologies
| Technology | Purpose |
|---|---|
| VMware ESXi | Type 1 virtualization |
| Hyper-V | Microsoft virtualization |
| VirtualBox | Desktop virtualization |
| VMware Workstation | Desktop virtualization |
| VMware Fusion | Mac virtualization |
| Parallels Desktop | Mac virtualization |
| Xen | Hypervisor |
| KVM | Linux kernel-based virtualization |
| QEMU | Emulation/virtualization |
| Docker | Containerization |
| LXC | OS-level containers |
39. KVM
KVM = Kernel-based Virtual Machine
It is a Linux virtualization technology integrated with the Linux kernel.
Conceptually:
Linux Kernel ↓ KVM ↓ Virtual Machines
KVM uses hardware virtualization capabilities provided by modern CPUs.
40. QEMU
QEMU can perform:
- hardware emulation
- virtualization when combined with suitable host acceleration
For example:
QEMU ├── Virtual hardware ├── Disk ├── Network └── CPU emulation/virtualization
41. Hypervisor Architecture
Type 1
┌────────┬────────┬────────┐ │ VM 1 │ VM 2 │ VM 3 │ ├────────┴────────┴────────┤ │ Hypervisor │ ├──────────────────────────┤ │ Physical Hardware │ └──────────────────────────┘
Type 2
┌────────┬────────┬────────┐ │ VM 1 │ VM 2 │ VM 3 │ ├────────┴────────┴────────┤ │ Hypervisor │ ├──────────────────────────┤ │ Host OS │ ├──────────────────────────┤ │ Physical Hardware │ └──────────────────────────┘
42. Complete Virtualization Flow
PHYSICAL COMPUTER │ ↓ CPU / RAM / SSD │ ↓ HYPERVISOR │ ┌────────────┼────────────┐ ↓ ↓ ↓ VM 1 VM 2 VM 3 ↓ ↓ ↓ Linux Windows Linux ↓ ↓ ↓ Applications Applications Applications
The hypervisor manages the physical resources and presents virtual resources to each VM.
43. Key Terms
| Term | Meaning |
|---|---|
| Virtualization | Creating virtual computing resources |
| Hypervisor | Software layer managing VMs |
| VM | Virtual computer |
| Host | Physical/underlying environment |
| Host OS | OS running on physical machine in Type 2 |
| Guest OS | OS inside VM |
| vCPU | Virtual CPU |
| Snapshot | Saved VM state/point |
| Clone | Copy of a VM |
| Live Migration | Move running VM between hosts |
| Type 1 | Bare-metal hypervisor |
| Type 2 | Hosted hypervisor |
| Hardware-assisted virtualization | CPU support for efficient virtualization |
🧠 Exam Revision
What is virtualization?
Virtualization is the creation of virtual computing environments that share physical hardware through a hypervisor.
What is a hypervisor?
A hypervisor is software or firmware that creates, runs, and manages virtual machines and allocates physical resources to them.
Two types:
Type 1 → Bare Metal Type 2 → Hosted
Most important difference:
Type 1: Hardware ↓ Hypervisor ↓ VM Type 2: Hardware ↓ Host OS ↓ Hypervisor ↓ VM
VM vs Container:
VM → Guest OS + Virtual Hardware Container → Application + Dependencies + Shared Kernel
Memory trick:
Virtualization = One Physical Machine → Many Virtual Machines
And remember:
Hypervisor = Manager of Virtual Machines