How virtual machines work
What is a virtual machine?
A virtual machine (VM) is a software-defined computer that runs its own guest operating system and applications. A hypervisor manages access to the underlying computing hardware so several VMs can share one physical host.
Imagine a bookstore that wants separate computers for its web application and inventory service. Instead of buying two machines, it could run two VMs on one server. Each VM can start and restart separately, but both still depend on that physical server.
Host, hypervisor and guest
The host is the physical computer, including processors, memory, storage and network interfaces. The hypervisor is the layer that manages virtual machines and their access to those resources. A guest operating system is the OS running inside a VM, such as Linux or Windows. Each guest has its own kernel, applications and virtual hardware configuration.
VM A: bookstore web app VM B: inventory app Guest OS A Guest OS B vCPU, RAM, disk, vNIC vCPU, RAM, disk, vNIC \ / Virtualization layer Physical hostText alternative: two separate guest operating systems run above a shared virtualization layer. Their virtual processors, memory, disks and network interfaces use resources on the same host. The diagram is a logical model, not an exact product implementation.
How virtual hardware works
A virtual CPU (vCPU) is a processor execution context that the guest sees. The virtualization system schedules its execution on host processors. Four vCPUs do not necessarily mean four dedicated physical cores. The guest sees memory addresses that the virtualization system maps to host memory, typically with hardware assistance. The guest's virtual disk may be backed by a host file, block device or remote storage. Its virtual network interface (vNIC) connects through virtual networking and may reach other guests or external networks if the configuration permits it.
When the web app reads a product file, it asks its guest OS for data. The guest OS issues disk I/O, which the virtualization system and storage backend handle. The guest need not know the physical disk model. When the app sends a response, the guest uses its vNIC; virtual networking and the underlying network deliver the traffic. Virtual devices can be emulated, optimized with guest drivers, or backed by assigned hardware. These paths differ by platform.
Type 1 and type 2 hypervisors
A type 1 hypervisor runs at the hardware virtualization layer rather than as an ordinary application on a general-purpose host OS. A type 2 (hosted) hypervisor is commonly presented as running above an existing host operating system. This distinction is a useful introductory model, not a perfect description of every modern architecture.
Microsoft Hyper-V is classified as type 1 even though Windows provides management services in its privileged root partition. KVM uses Linux kernel virtualization support and is commonly paired with QEMU for virtual machine and device management. Do not infer the architecture just from the management screen. VMware ESXi is an example of a bare-metal virtualization platform; hosted desktop tools are a different deployment model. Licensing, supported guest systems and versions must be checked before installation.
Hardware-assisted virtualization features such as Intel VT-x and AMD-V help run compatible guest code and enforce virtualization boundaries. Availability depends on processor, firmware, host software and, for nested virtualization, the outer hypervisor. Emulating a different CPU architecture is a distinct capability and may have different performance.
Example: two guests, one physical host
Consider a fictional host with a web VM and an inventory VM. The web VM has 2 vCPUs, 4 GiB RAM and a 40 GiB virtual disk. The inventory VM has 2 vCPUs, 8 GiB RAM and an 80 GiB virtual disk. These are assigned capacities, not measured usage. Each guest has its own operating system and can be maintained separately.
If the web guest reboots after an update, the inventory guest may continue working. If the physical host loses power, both guests may stop. If both virtual disks depend on the same storage system, a storage outage may affect both even when their CPU and memory remain healthy. Separate VMs provide a useful isolation boundary but not independent failure domains by themselves.
Common mistakes and safe next steps
- A VM is not a container: a conventional VM runs a guest kernel, while ordinary OS-level containers share a kernel. The container model is covered in the next chapter.
- Virtual networks do not guarantee isolation by name alone. Check network and identity access policies.
- A VM is not automatically a cloud service. The cloud adds capabilities such as self-service and metering.
- Do not assume a guest is safe simply because it is virtualized. Patch the host and guest, restrict management access and use supported isolation features.
Practice offline: draw the two bookstore VMs, label the physical host, virtualization layer and each guest OS and virtual device. Trace an inventory disk read and identify what fails if the host loses power. No hypervisor installation, cloud account or credentials are required. Next, learn to plan VM capacity and recovery.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
How virtual machines work — knowledge check
Choose the best answer for each fictional scenario.
What runs inside a conventional VM?
Two VMs share one physical host. The host loses power. What is possible?
What does assigning four vCPUs establish?
Which statement about Hyper-V is correct?
Which device gives a guest a network interface?