Virtualisation in a nutshell
We summarise the tech that makes virtualisation possible and fun.
any old computer can run a virtual machine. People have been running emulators for years after all. But impersonating a foreign architecture is hard work, so those emulation tends to focus on machines much less powerful than the host.
However, when we emulate a machine that’s architecturally similar to our host, we can take some shortcuts. Instead of emulating the CPU and other hardware we can pass instructions to that hardware. The more of this we do, the more we move from the emulation to the virtualisation end of the spectrum.
To do virtualisation properly, we need a hypervisor that sits above the VM and marshals calls between the guest and host. We don’t want our hypervisor to do nothing, otherwise it would be pointless and allow for a guest to do undesirable things to the host, but we also don’t want it to do too much, either.
Since around 2006, new CPU features (Intel’s VT-x and AMD-V) have enabled the development of elegant hypervisors that fit the bill perfectly. Linux has KVM, Windows has Hyper-V, then there’s the Xen hypervisor, which runs above a privileged, virtualised OS domain (dom0, which can run any OS you like) . Less-privileged (domU) VMs use dom0 for all their hardware access, and the hypervisor at the top ensures everything’s isolated. The security-focused Qubes OS uses Xen virtualisation to keep applications separated. Further CPU innovations (Intel’s VT-d and AMD-Vi) give VMs direct access to peripherals. It’s this magic, together with Open Virtual Machine Firmware (OVMF) and the wonders of the VFIO driver, that allow us to pass a whole graphics card to a Windows 10 VM and have it perform within a whisker of native speed and run all those games that don’t yet work properly with Steam Play.
Virtualisation is also a great way of backing up a physical server. Once you have a virtual mirror or your server, you can snapshot it and experiment with various configuration changes or updates that it would be imprudent to apply in production. If they fail miserably then it’s trivial to roll back and try again. If your physical server fails, then it’s straightforward (in principle) to physicalise (that’s really not a word – Ed) your virtual backup on new hardware. Alternatively, just spin up a copy of this VM – the cloud is full of virtual machines.