OS//virtualization//virtual machine
A virtual machine (VM) is a software-defined computer, with its own virtual processors, memory, disk and network card, that runs a complete operating system on top of a physical machine shared with other VMs, and it is the basic unit sold by cloud providers and the standard way to run several isolated systems on one server. Inside, the **guest OS** boots and behaves as if it owned real hardware; outside, the **hypervisor** decides which physical resources each VM actually gets (virtualization).
A virtual machine (VM) is a software-defined computer, with its own virtual processors, memory, disk and network card, that runs a complete operating system on top of a physical machine shared with other VMs, and it is the basic unit sold by cloud providers and the standard way to run several isolated systems on one server. Inside, the guest OS boots and behaves as if it owned real hardware; outside, the hypervisor decides which physical resources each VM actually gets (virtualization).
The hypervisor comes in two kinds. A type 1 (bare-metal) hypervisor runs directly on the hardware and is the operating system of the host itself, as KVM, Xen, VMware ESXi and Hyper-V do in data centers and clouds. A type 2 hypervisor runs as an application on a normal desktop OS (VirtualBox, VMware Workstation), handy for a developer who wants a Linux machine inside Windows. Modern CPUs carry instructions that let guests run at nearly native speed, and the hypervisor only steps in for privileged operations and devices.
Strong isolation is the reason to choose it. Each VM has its own kernel, so a crash, a compromise or a misconfiguration stays inside its walls unless the hypervisor itself has a flaw; that is why clouds separate customers with VMs (multi-tenancy).
The price is weight. Each VM carries a whole operating system: hundreds of megabytes to gigabytes of memory and disk, seconds to minutes to boot, and an OS to patch. A container shares the host's kernel instead and starts in milliseconds, which is why the two are often stacked, containers inside VMs.
VMs can be snapshotted, copied and moved live between hosts while running, which lets a provider service hardware without stopping customers; the same flexibility is what bare metal gives up for full performance and direct access to GPUs and network cards.
The overhead that remains is in input and output and in shared resources: two VMs on one host compete for memory bandwidth, caches and disks, the noisy-neighbour effect that makes performance on a shared host less predictable than on a dedicated one.