Sub topic 3
How the Cloud Works Underneath: Virtualization and Pooling
This chapter explains the mechanism that makes on-demand cloud services possible. It assumes you know what a server, an operating system, and an application are, and that you recognize terms like IP address and HTTP. By the end you should be able to explain how one physical machine becomes many virtual ones, how a provider shares hardware among customers, and why that sharing produces some of the behavior you see as a cloud user.
The problem virtualization solves
A physical server has a fixed amount of CPU, memory, storage, and network capacity. Before the cloud, a team typically bought a server for one job. Most of the time that server sat mostly idle, because it was sized for peak load. Buying hardware also took weeks, and returning it was not an option.
Cloud providers need the opposite: capacity that appears in seconds, is sized to each customer, and can be reclaimed when the customer is done. Virtualization is the technique that makes this possible.
Virtualization is the practice of creating a software-defined version of a computer, called a virtual machine (VM), that behaves like a real one. The VM has its own virtual CPUs, memory, disks, and network interfaces. The operating system inside it cannot tell that the hardware is simulated or shared.
Hypervisors
A hypervisor is the software layer that creates virtual machines and divides the physical hardware among them. The physical machine it runs on is called the host. Each virtual machine is a guest.
There are two broad designs:
| Type | Runs on | Typical use |
|---|---|---|
| Type 1 (bare-metal) | Directly on the hardware, with no general-purpose OS underneath | Cloud data centers and enterprise servers |
| Type 2 (hosted) | As an application on top of a normal operating system | Developer laptops and desktop testing |
Public cloud platforms use Type 1 designs, such as KVM-based hypervisors and the AWS Nitro system. Nitro moves much of the networking, storage, and security work onto dedicated hardware cards, so more of the host's CPU goes to guests.
The hypervisor has three jobs:
- Allocate resources. It gives each guest a share of CPU time, a slice of memory, and virtual devices.
- Isolate guests. One guest cannot read another guest's memory or disks, even though both run on the same chip.
- Mediate access. When a guest tries to use hardware, the hypervisor or hardware-assisted virtualization features translate the request.
Modern CPUs include virtualization extensions (Intel VT-x, AMD-V). These let guest code run directly on the processor at nearly native speed, with the hypervisor stepping in only for privileged operations. This is why virtual machines are fast enough for production work.
Resource pooling
Virtualization lets you cut one machine into many. Resource pooling is the other half of the idea: the provider combines thousands of physical machines into one large shared supply, then assigns pieces of it to customers as they ask.
This is the "resource pooling" characteristic in the standard definition of cloud computing. Customers share the same underlying pool, which is called multi-tenancy. A tenant is a customer, and many tenants run on the same hardware at the same time. As a customer, you normally do not know which physical server holds your VM and you do not choose it. You usually pick only a broad location, such as a region (covered in a later chapter).
Pooling pays off because customers do not all need their peak capacity at the same moment. A retailer may peak in the evening, while a batch-processing job peaks overnight. The provider can serve both from the same hardware. This statistical sharing is the reason cloud capacity can cost less than owning equivalent idle hardware.
From a request to a running machine
When you ask for a VM, several components cooperate. The diagram shows a simplified version of the flow.
The control plane is the provider's management software. It tracks which hosts have free capacity, picks one for your request (a step called placement or scheduling), and instructs the hypervisor to build the VM from an image. An image is a saved template of a disk that contains an operating system and, optionally, software. You see the result as an instance ID and an IP address.
The same API that created the VM also deletes it. When you delete it, the provider reclaims the CPU, memory, and disk, scrubs the storage, and returns the capacity to the pool.
Seeing it from the CLI
You can observe the abstraction directly. The instance type you pick is a named bundle of virtual resources. This command asks for the specification of one type:
aws ec2 describe-instance-types \
--instance-types t3.micro \
--query "InstanceTypes[0].{vCPUs:VCpuInfo.DefaultVCpus,MemoryMiB:MemoryInfo.SizeInMiB,Network:NetworkInfo.NetworkPerformance}"The output reports virtual CPUs and memory, not a physical chip or a specific server. The provider promises a quantity of capacity, and the pool decides where it comes from.
How this produces the essential characteristics
Virtualization and pooling are the machinery behind the characteristics from the previous chapter:
- On-demand self-service. Because a VM is software, the control plane can create one without a person touching hardware.
- Rapid elasticity. The pool is large, so new capacity for one customer usually comes from spare space that already exists. Releasing a VM returns it just as fast.
- Resource pooling. Many tenants share the same hosts, separated by the hypervisor.
- Measured service. The hypervisor and control plane can count how long each VM ran and what size it was, which is the basis for billing.
Edge cases and common surprises
Sharing hardware has consequences. Knowing them prevents several common errors.
Noisy neighbors
A noisy neighbor is another tenant on the same host whose heavy use reduces the performance you get. Providers limit the effect with resource caps and scheduling, but shared resources such as disk throughput and network bandwidth can still vary. If your performance is inconsistent, a dedicated host or a larger instance size can help.
Burstable and oversubscribed capacity
Providers can sell more virtual CPUs than there are physical cores, because most guests are idle most of the time. This is called oversubscription. Some instance families, such as the T-series on AWS, make the idea explicit: you receive a baseline share of a CPU and accumulate credits while idle. You spend the credits when you need a burst. A workload that runs hot all day exhausts its credits and is throttled to the baseline.
Isolation is strong but not absolute
Hypervisor isolation is a core security feature, and escapes are rare. Side-channel attacks such as Spectre and Meltdown showed that shared CPU hardware can leak information between guests under some conditions. Providers responded with patches and hardware changes. Workloads with strict requirements can use dedicated hardware, so that no other tenant shares the host.
A virtual machine is not a container
A VM virtualizes the hardware, so each guest runs its own full operating system. A container shares the host's operating system kernel and isolates only processes and their files. Containers start faster and use less memory, but their isolation boundary is thinner. In practice, many cloud container services run containers inside VMs to combine the two benefits. Later chapters return to containers as a service.
| Aspect | Virtual machine | Container |
|---|---|---|
| What is virtualized | Hardware | Operating system view |
| Kernel | One per guest | Shared with host |
| Start time | Seconds to minutes | Often under a second |
| Isolation | Strong, hardware-assisted | Weaker, kernel-level |
Capacity is finite
The pool looks infinite, but it is not. In a rare case, a region or zone has no free capacity of the type you asked for, and the request fails with an insufficient-capacity error. The usual fixes are to try another instance type, another availability zone, or to reserve capacity in advance.
Instances are replaceable, not permanent
If a physical host fails, the VMs on it may stop. Because a VM is software, the provider can restart it on another host. Data on the instance's local, ephemeral storage may be lost, while data on separate network-attached volumes persists. Design with this in mind: treat any single instance as disposable and keep important state somewhere durable.
Why this matters for service models
IaaS exposes the virtualization layer most directly: you receive virtual machines, networks, and disks. PaaS and SaaS build on the same pool but hide it. A PaaS runs your code on VMs or containers that the provider manages, and a SaaS vendor runs its application on infrastructure you never see. Understanding the foundation helps you predict their behavior, such as why a platform may restart your app on a different machine, or why a shared service can slow down at busy times.
Exercise
A team runs a CPU-heavy batch job on a burstable instance type. The first hour is fast, then performance drops to a fraction of the starting speed and stays there. Using the ideas in this chapter, explain the likely cause and give two possible fixes.
Show answer
Burstable instances give a baseline share of a CPU and earn credits while idle. The job spent its accumulated credits during the first hour, so the instance was throttled to its baseline. The result is a consequence of oversubscription in the shared pool. Fixes: move to a non-burstable instance family that provides full CPU continuously, or enable the unlimited credit mode where available and accept its extra cost. Spreading the work over more, larger instances also works.
Exercise
What is the difference between virtualization and resource pooling, and why does the provider need both?
Show answer
Virtualization divides one physical machine into several isolated virtual machines through a hypervisor. Resource pooling combines many physical machines into one shared supply from which the control plane assigns capacity to many tenants. Virtualization makes capacity easy to cut into right-sized pieces and isolate. Pooling makes it possible to place those pieces anywhere in the fleet and to reuse capacity as demand moves between customers. Together they provide on-demand, elastic, measured capacity.