MainHistoryExamplesRecommended Reading
Explain Like I'm 5 /Infrastructure

What is a Virtual Machine?

Help others learn from this page

One or more virtual "guest" machines run on a physical "host" machine. Each virtual machine runs its own operating system and functions separately from the other VMs, even when they are all running on the same host. This means that, for example, a virtual MacOS virtual machine can run on a physical PC.
VMWare/ Documentation
image for entry

VMs create isolated environments on a host system through a hypervisor layer (Illustration by John Aplessed)

A Virtual Machine (VM) is like a computer inside your computer. Imagine you're a developer who needs to test software on Windows, but you're running macOS — or you want to run an isolated Linux server without touching your host system. A VM lets you spin up a full operating system (OS) in a sandboxed environment, without needing new hardware.

Think of it as a box-within-a-box: it acts like a real machine, but it's just software.


What It Is — Technically:

A virtual machine is a software emulation of a physical computer. It runs an operating system and applications just like a physical machine does. The virtualization layer — called a hypervisor — allocates slices of your system's actual hardware (CPU, memory, disk) to these virtual environments.

There are two types of hypervisors:

  • Type 1 (bare metal): Runs directly on hardware (e.g., VMware ESXi, Microsoft Hyper-V)
  • Type 2 (hosted): Runs on top of another OS (e.g., VirtualBox, VMware Workstation)

How It Works:

  1. You install a hypervisor
  2. You configure a VM: choose its OS, disk size, memory, CPU, etc.
  3. The hypervisor starts the VM as a process on your machine
  4. From inside, it behaves like a separate, fully functioning computer

Key Features:

  • Isolation: VMs don't interfere with the host system or other VMs
  • Flexibility: Run multiple operating systems on a single machine
  • Snapshotting: Save the exact state of a VM and roll back if needed
  • Portability: Move or clone VMs across environments

Why Devs and Ops Teams Use VMs:

  • Safely test untrusted code or environments
  • Run old software that depends on outdated OS versions
  • Spin up temporary infrastructure for CI/CD pipelines or load testing
  • Package development environments for teams

Limitations:

  • Performance Overhead: VMs are heavier than containers (like Docker)
  • Boot Time: VMs take longer to start compared to containers
  • Resource Usage: Each VM requires its own OS image, memory, and storage

VM vs Container:

VMs emulate entire operating systems. Containers (e.g., Docker) share the host OS kernel but isolate applications. VMs are more isolated and secure, while containers are faster and more lightweight. You often choose one over the other based on the trust boundary and performance requirements.

VMs helped define cloud computing. AWS EC2, for example, was built entirely on virtual machines for years — allowing thousands of users to share physical servers safely and predictably.

FAQ

How is a virtual machine different from my regular computer?
Your regular computer runs a single OS directly on physical hardware. A VM runs *inside* your computer as software, and it can have its own OS — like a separate machine within yours.
Do virtual machines run slower?
Yes, slightly. VMs add a layer of abstraction, so they typically have more overhead than running software directly on hardware. But for many use cases, especially development and testing, the performance difference is negligible.
What is a hypervisor?
A hypervisor is the software that creates and runs virtual machines. It controls how your real hardware is divided up and assigned to each VM. Without it, virtualization wouldn't be possible.
Can I run multiple VMs at once?
Absolutely — as long as your machine has enough resources (RAM, CPU, disk). Each VM runs in isolation, so you could have Windows, Linux, and macOS all running side by side on one host.
Is a VM the same as a container?
Nope. A VM runs a full OS and emulates hardware. A container shares the host's OS kernel and only isolates the app and its dependencies. Containers are faster to start and lighter, but less isolated.

Related Stuff

  • What is Docker?: Learn how containers work, and why developers use them to build and ship software faster
  • What is Cloud Computing?: Understand how services like AWS and Azure deliver compute power using VMs and containers
  • What is Serverless?: A compute model where infrastructure is abstracted away — often built on top of VMs
  • What is WebAssembly?: How WASM runs code in a secure virtual machine inside your browser

Enjoyed this explanation? Share it!