Virtual machine (VM)
In short: A virtual machine is a computer that exists only as software. It behaves like real hardware but runs as a program on another computer. The term has two meanings: system VM and process VM.
In more detail: A system VM (VirtualBox, VMware, KVM, Hyper-V) simulates a whole PC including its operating system. A process VM (JVM, .NET CLR), by contrast, runs only a single program in an abstract environment.
In Depth
| System VM | Process VM | |
|---|---|---|
| Examples | VirtualBox, VMware, KVM, Hyper-V, QEMU | JVM, CLR, BEAM, Dalvik/ART |
| Simulates | a whole computer incl. operating system | a runtime environment for one program |
| Lifetime | as long as the VM runs | as long as the program runs |
| Purpose | several operating systems, sharing servers, test environments | platform independence, security, memory management |
With a system VM, a hypervisor distributes CPU, memory and devices:
- Type 1 (“bare metal”): runs directly on the hardware (KVM, Xen, ESXi, Hyper-V). Common in data centers.
- Type 2: runs as a program in the normal operating system (VirtualBox, VMware Workstation).
- Hardware support: Intel VT-x / AMD-V make virtualization almost as fast as real hardware.
Advantages: Isolation (a crash or virus stays in the VM), snapshots (save and restore state), easy copying and moving, better server utilization, risk-free testing.
Disadvantages: Performance loss (small), memory demand (each VM has a full operating system), administration effort.
- Difference from containers: Containers (Docker) share the host’s kernel and are much lighter. VMs separate more strongly.
- Emulation: If the VM imitates a different processor architecture (QEMU ARM on x86), it is much slower.
- Cloud: Rented servers at AWS, Azure or Hetzner are, as a rule, virtual machines.
- Typical tasks: Trying out Linux, running old software, analyzing malware safely, development environments.
See also: Sandbox, JVM (Java Virtual Machine), Kernel (operating system core)