Virtual Machines
Learn how VMs virtualize hardware, how hypervisors schedule resources, and how to build a safe local lab.
Virtualization lets one physical computer behave like several independent computers. A software layer divides the host’s processor, memory, storage, and network into virtual resources, so each guest can run its own operating system and applications. This makes it possible to test another operating system, consolidate services, or create a repeatable learning lab without buying another machine.
Picture it: A physical computer is like an apartment building. The hypervisor is the building manager, and each VM is a private apartment with its own space and rules.
What makes a virtual machine?
A host is the physical computer and its operating system. A guest is the operating system installed inside a virtual machine (VM). The hypervisor, also called a virtual machine monitor, creates the VM and mediates its access to the host’s hardware.
The VM sees virtual devices: a number of CPU cores, a portion of memory, a virtual disk, and network adapters. The guest operating system uses these much like physical hardware. The hypervisor schedules virtual CPUs on real CPU cores, allocates memory, and stores the virtual disk as files or logical volumes.
Hypervisor types
Type 1 hypervisors run directly on the hardware and are common in data centres. Examples include VMware ESXi, Microsoft Hyper-V, and KVM-based platforms. They are designed to manage many VMs and make efficient use of server resources.
Type 2 hypervisors run as applications on a desktop operating system. VirtualBox and VMware Workstation are familiar examples. They are convenient for a personal computer because you can start and stop VMs alongside your normal apps.
Both types create isolated guests, but neither makes a VM invulnerable. Keep the host and guest patched, use trusted VM images, and avoid exposing services you do not need.
Why use virtualization?
- Isolation: a guest’s operating system and applications are separated from other guests.
- Consolidation: multiple services can share one physical server instead of each needing its own machine.
- Repeatability: a VM can be recreated from a known image, making tests and training exercises easier to repeat.
- Snapshots: many hypervisors can save a VM’s state before a change, which is useful for short-lived experiments.
The trade-offs are resource use and operational work. Every full VM needs an operating system, memory, storage, updates, and backups. Containers usually start faster and use fewer resources because they share the host kernel, while VMs provide a separate guest kernel and a stronger boundary for many use cases.
CPU and memory are shared resources
A virtual CPU is scheduled onto physical CPU cores; it is not automatically a dedicated core. Assign only the vCPUs the workload can use, then observe host and guest performance. Giving many idle VMs oversized CPU allocations can make scheduling less predictable.
Guest memory also comes from a finite host pool. Leave memory for the host, and monitor pressure before increasing VM allocations. Dynamic memory and overcommit features can help an administrator use capacity flexibly, but they cannot remove the host’s physical limits.
Build a small learning lab
- Check the host. Confirm that hardware virtualization is enabled in the firmware and that your computer has enough free memory and disk space. Leave resources for the host to remain responsive.
- Choose a hypervisor. Use a desktop hypervisor such as VirtualBox for a first local lab, or a Type 1 platform when learning server virtualization. Download it from its official source.
- Choose a guest image. Obtain an operating system image from its publisher and review the system requirements. Start with one guest so it is easier to understand how resource allocation works.
- Create the VM. Give it a clear name, select the guest operating system, and assign a modest amount of memory, CPU, and disk. A dynamically allocated virtual disk can grow as needed, but still consumes space on the host.
- Install and update the guest. Boot from the image, follow the operating system installer, then apply updates. Use a standard user account for everyday work and reserve administrator access for tasks that need it.
- Experiment safely. Take a snapshot before a practice change, then observe CPU, memory, disk, and network use. Revert the snapshot when finished; do not treat snapshots as a backup.
Networking and storage basics
A VM’s network adapter can commonly be NAT, bridged, or host-only. NAT lets the guest make outbound connections through the host, bridged mode puts it on the local network like another computer, and host-only mode limits communication to the host and selected guests. Choose the narrowest mode that supports the exercise, especially when testing unfamiliar software.
The VM’s virtual disk is backed by storage on the host. Keep enough free space for both the virtual disk and snapshots, and make separate backups of data you want to keep. A snapshot is a convenient checkpoint, not a substitute for an independent backup.
Before you finish the lab
- The guest boots, is updated, and uses an ordinary account for day-to-day work.
- The VM has only the CPU, memory, disk, and network access needed for the exercise.
- You can identify which network devices can reach the guest.
- Any snapshot is temporary; important files have an independent backup.
- Lab-only services and resources are removed when the exercise ends.
You now have the core VM mental model: a guest OS uses virtual hardware, a hypervisor maps it to a shared host, and the administrator controls resource limits, connectivity, and recovery. Continue with the complete Virtualization roadmap to connect this VM to containers, cloud infrastructure, and server clusters.