Virtualization & Containers

machine virtualization

Imagine you own one physical computer but you want to run several completely separate computers on it - one running Linux, one running Windows, one you can crash and reboot without disturbing the others. Machine virtualization is the trick that makes one real machine pretend to be many. Each pretend machine believes it has its own CPU, its own memory, its own disk and network card, and runs its own operating system from scratch - yet they all share the same physical hardware underneath.

The way it works is that a thin layer of software sits between the real hardware and these fake computers. That layer hands each fake machine a slice of the real CPU's time, a region of real memory dressed up to look like the whole memory of a small computer, and software stand-ins for the disk and network. When a fake machine tries to do something only the real hardware can do (like talk to a disk controller), the layer underneath intercepts it and quietly does the real work on its behalf. The fake machine never realises it is sharing.

This matters because it turned one expensive server into a flexible pool that many tenants can split, which is the foundation of cloud computing - when you rent a server in the cloud, you are almost always renting a virtual machine on shared hardware. It also gives you strong isolation (one virtual machine crashing or being hacked does not directly take down its neighbours) and the freedom to snapshot, copy, or move a whole running computer like a file. The honest cost is overhead: every intercepted hardware operation costs extra CPU time, so a virtual machine is always at least slightly slower than running directly on the metal.

One physical server with 64 GiB of RAM and 16 CPU cores hosts eight virtual machines, each told it has 8 GiB and 2 cores. Each boots its own Linux kernel; the host adds up to 64 GiB but oversubscribes the cores, betting that not all eight peak at once.

One real machine sliced into eight virtual ones, each running its own operating system.

Machine virtualization gives each guest its own kernel and a full fake set of hardware - this is the heavyweight kind. Containers (OS-level virtualization) are a different, lighter idea that shares one kernel; do not conflate the two.

Also called
hardware virtualizationfull-machine virtualization硬體虛擬化