Tech, ExplainedCloud platforms and developer tools
Concept

Virtual machines

One server acting as twenty.

HOW IT WORKSA real serverhas processors,memory and disksA hypervisordivides them intoseparate sharesEach share runs asa virtual machinewith its ownoperating systemEach virtualmachine runs itsown apps, kept apartfrom the othersVirtual machines canbe started, copied ormoved in minutesOne physical server can safely run many apps for many users, instead of standing mostly idle.HOW IT WORKSA realserver hasprocessors,memoryand disksA hypervisordivides theminto separatesharesEach shareruns as avirtualmachine withits ownoperatingsystemEach virtualmachineruns its ownapps, keptapart fromthe othersVirtualmachines canbe started,copiedor movedin minutesOne physical server can safely run many apps for many users, instead of standing mostly idle.HOW IT WORKSA real server hasprocessors, memory and disks↓A hypervisor dividesthem into separate shares↓Each share runs as a virtual machine withits own operating system↓Each virtual machine runs its own apps,kept apart from the others↓Virtual machines can be started, copiedor moved in minutesOne physical server can safely run many apps for manyusers, instead of standing mostly idle.
A hypervisor on one physical server divides its processors, memory and disk into shares, and each share runs as a separate virtual machine with its own operating system and apps.
opens a page inside this one a page in the same scene a page in another scene a concept page a label only, with no page

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

Cloud platforms and developer tools
Data platforms and AI
Tech, Explained is a part of ingrid.fyi. Every page explains one piece of technology in plain words.