Virtual machines are pretend computers that software creates on one real server. Each virtual machine, or VM, has its own operating system and its own share of the server's processors, memory and disk. To the programs inside it, a VM looks exactly like a separate computer. So one physical server can serve as ten or twenty computers. Most companies, and every cloud provider, run their software on virtual machines.
Here is how it works. A physical server, called the host, runs a program called a hypervisor. The hypervisor divides the server's processors, memory and disks into shares. Each share becomes a virtual machine, also called a guest. For example, the hypervisor may give one VM 4 processor cores, 16 GB of memory and 200 GB of disk. Each VM then runs its own operating system, such as Linux or Windows, and its own apps. The hypervisor keeps the VMs apart. A crash, a virus or a mistake inside one VM cannot reach the others. A VM can be started in minutes, copied, saved as a snapshot, or moved to another server while it is still running.
Why does this matter? Before virtual machines were common, a company usually ran each app on its own server. Most of those servers were busy for only a small part of the day, yet each one needed space, power and cooling. With VMs, many apps share fewer servers, and each server is kept much busier. VMs also made cloud computing possible. A cloud provider splits its servers into VMs and rents each one by the hour, and a customer can start or stop one in minutes. Backup and recovery became simpler too, because a whole VM can be copied as a set of files and started again on another server.
Take, for example, a two-person start-up building a booking app for yoga classes. It rents a virtual private server with 2 processor cores and 4 GB of memory, by the month, instead of buying a server.
Consider a hospital's IT team that runs 30 old apps, each on its own ageing server. The team moves all 30 apps into VMs on three new servers, and switches the old servers off.
Say an engineering student has a Windows laptop but needs Linux for a course. She runs Linux in a VM on the laptop. If she breaks it, she deletes the VM and starts again.
How are virtual machines different from containers? A VM carries a whole operating system of its own, so it uses gigabytes of memory and can take a minute or more to start. A container packs only an app and the files it needs, and shares the host's operating system. So it is much smaller, and it starts in seconds. VMs keep programs further apart, which is safer when the programs belong to different customers. In practice, containers and Kubernetes often run inside VMs. The Java virtual machine is a different idea, despite its name. It runs Java programs on any operating system, but it does not pretend to be a whole computer.
Appears in
- Developer cloud↗ Cloud hostingA developer cloud rents virtual machines to start-ups by the hour, together with storage, managed databases and GPU servers.
- Virtual private server (VPS)↗ Cloud hostingA virtual private server is one virtual machine rented to one customer, with its own operating system and a fixed share of a real server.
- Private cloud software↗ Infrastructure softwarePrivate cloud software creates and places virtual machines across an organisation's own servers, including small edge sites, so the organisation can use them or rent them out.
- Hypervisor and virtualisation↗ Infrastructure softwareA hypervisor is the software that creates virtual machines, splitting one physical server into many, each with its own operating system.
- Hyperconverged infrastructure (HCI)↗ Infrastructure softwareHyperconverged infrastructure runs virtual machines on a group of ordinary servers that also provide the storage, with no separate storage array.
- Backup and recovery↗ Data storage and backupBackup and recovery software copies whole virtual machines on a schedule, so a failed or encrypted server can be started again from a clean copy.