VM (Virtual Machine)

Definition

A VM is a software-emulated computer that runs an operating system and applications just like a physical machine. It runs on a hypervisor that abstracts and allocates the host’s CPU, memory, storage, and network resources among multiple VMs.

VMs provide isolation (each VM has its own OS instance), consolidation (many VMs on one physical host), and portability (VMs can be moved between hosts).

Key Concepts

  • Hypervisor Type 1 (Bare Metal): Runs directly on hardware (ESXi, KVM, Hyper-V)
  • Hypervisor Type 2 (Hosted): Runs on an OS (VirtualBox, VMware Workstation)
  • Live Migration: Moving a running VM between hosts without downtime (vMotion, Live Migration)
  • Snapshot: Point-in-time copy of VM state for backup/rollback
  • Guest OS: The OS installed inside the VM
  • Resource Allocation: CPU cores, RAM, storage, network interfaces assigned per VM

VM vs Container

Feature VM Container
OS Full guest OS Shares host kernel
Startup Minutes Milliseconds
Overhead High (GBs) Low (MBs)
Isolation Strong (hardware) Weaker (namespace/cgroup)
Use case Legacy apps, different OS Microservices, CI/CD