Hypervisor
- Pronunciation
- HY-per-vy-zer
In short
A hypervisor is software that creates and runs virtual machines, sharing one physical computer's CPU, memory, and devices among several isolated guest systems.
What is a hypervisor?
A hypervisor, also called a virtual machine monitor, is the layer of software that makes virtual machines possible. It sits between the physical hardware and one or more guest operating systems, gives each guest its own virtual CPUs, memory, disks, and network cards, and keeps the guests isolated from each other.
A type 1, or bare-metal, hypervisor runs directly on the hardware, as Xen, VMware ESXi, Microsoft Hyper-V, and KVM do; KVM is built into the Linux kernel and turns Linux itself into a hypervisor. A type 2, or hosted, hypervisor runs as an application on a normal operating system, as VirtualBox does. Modern CPUs include hardware virtualization features, such as Intel VT-x and AMD-V, that let guest code run directly on the processor at nearly full speed, with the hypervisor stepping in only for sensitive operations. Memory is virtualized with an extra layer of address translation, and devices are either emulated, provided through efficient paravirtual drivers, or passed straight through to a guest.
A hypervisor is like a landlord who divides one building into apartments. Each tenant has a private, locked unit with its own kitchen, while the landlord manages the shared plumbing and power and makes sure no tenant can walk into another's home. Hypervisors power cloud computing, where every virtual server runs on one, and they are used for server consolidation, running other operating systems on a laptop, sandboxes for testing, and lightweight microVMs behind some serverless platforms.
A hypervisor is often confused with the virtual machine itself: the hypervisor is the manager, and the virtual machine is the simulated computer it runs. It is also different from containers, which share the host's kernel and isolate processes with kernel features instead of emulating hardware, making them lighter but less strongly isolated. An emulator is different again: it can imitate a completely different CPU architecture by translating every instruction, which is much slower than running a guest natively on the same architecture.
Key takeaways
- A hypervisor creates, runs, and isolates virtual machines on one physical computer.
- Type 1 hypervisors run on bare metal; type 2 hypervisors run on top of an operating system.
- Hardware virtualization in modern CPUs lets guests run at near-native speed.
- Every virtual server in the cloud runs on a hypervisor.
- Containers share the host kernel and don't need a hypervisor.
Example
# A non-zero count means the CPU supports Intel VT-x (vmx) or AMD-V (svm)
grep -cE 'vmx|svm' /proc/cpuinfo
# Is the KVM hypervisor module loaded?
lsmod | grep kvm
# Am I inside a virtual machine? Prints the hypervisor type, or "none"
systemd-detect-virtReaders ask
What is the difference between a type 1 and a type 2 hypervisor?
A type 1 hypervisor runs directly on the hardware and is used in data centers and clouds. A type 2 hypervisor runs as an application on a regular operating system and is common on developer laptops.
Is Docker a hypervisor?
No. Docker runs containers, which share the host operating system's kernel instead of running separate guest kernels on virtual hardware. On macOS and Windows, however, Docker uses a small virtual machine behind the scenes to provide a Linux kernel.
What is the difference between a hypervisor and a virtual machine?
The hypervisor is the software that creates and manages virtual machines. A virtual machine is one of the isolated, simulated computers it runs, each with its own guest operating system.
See also
- Virtual MachineDevOps & Cloud, p. 53A virtual machine is a software-based computer that runs its own operating system on shared physical hardware, isolated from other machines on the same host.
- ContainerDevOps & Cloud, p. 12A container is a lightweight, isolated package that bundles an application with its dependencies and runs it on the host's shared operating system kernel.
- Cloud ComputingDevOps & Cloud, p. 10Cloud computing is the on-demand delivery of computing resources, such as servers, storage, and databases, over the internet with pay-as-you-go pricing.
- KernelOperating Systems, p. 17A kernel is the core part of an operating system that manages the CPU, memory, and hardware devices and controls how programs get access to those resources.
- DockerDevOps & Cloud, p. 17Docker is an open-source platform for packaging an application and everything it needs into a container that runs the same way on any machine.
- ServerlessDevOps & Cloud, p. 47Serverless is a cloud model in which the provider runs your code on demand, manages all the servers, scales automatically, and bills only for actual use.
Spotted a mistake or something missing on this page?Suggest an edit