Glossary

Virtual Machine

A virtual machine (VM) is a software emulation of a complete computer—virtual CPU, memory, disk, and peripherals—capable of running its own operating system, including its own kernel. Unlike containers, which share the host kernel, a VM is fully independent: a Linux VM can run on a Windows host, or vice versa, with strong isolation between guest and host.

VMs are managed by a hypervisor. Type 1 hypervisors run directly on hardware (Xen, KVM when treated as bare metal, VMware ESXi); Type 2 hypervisors run as applications on top of a host OS (VirtualBox, VMware Workstation). Linux's KVM, combined with QEMU for device emulation, powers most modern cloud VMs; libvirt provides a management API used by tools like virsh and virt-manager.

virt-install --name ubuntu --memory 4096 --vcpus 2 \
             --disk size=20 --cdrom ubuntu.iso
virsh list --all
virsh start ubuntu
virsh console ubuntu
virsh shutdown ubuntu

VMs offer stronger isolation than containers at the cost of size and startup time: each carries its own kernel, boot process, and full userland. For running untrusted code or hosting multiple tenants on shared hardware, VMs are preferred. For packaging applications for repeatable deployment, containers are lighter and usually sufficient.

Related terms: hypervisor, kvm, Container, qemu

Discussed in:

Also defined in: Textbook of Linux