Virtual services – machines, kind of – have been available since the 1960’s. At first, they were only really available on mainframes. It was a very useful feature, but the dinosaurs of computing, too, became extinct (more or less – the ones that are left are very tenacious), and with it went mass adoption of virtual computing.
Until, that is, personal computers became powerful enough to rediscover this old trick, and invent a few more.
What is a virtual machine? Well, it’s a piece of software which looks to the end user – you, or another piece of software – like a real machine. It’s not created out of nothing, it’s backed by real hardware, but it’s also not entirely a trick.
Machines like HP’s ‘UX’ unix servers offer both nPar and vPar flavours – npar is hp-speak for real partitioning. It means taking a larger machine and almost physically slicing it up. The machines that result are actually separated, electrically. vpar machines, on the other hand, are virtual partitioned. It’s a specialized type of virtualization, however, which cannot be matched by standard PC’s, as it takes special service processors and extra bells and whistles which just don’t exist on PC-compatibles.
For the rest of us, we have to use either type 1 hypervisors, or type 2… or hybrid ‘type 1.5′ hypervisors.
A hypervisor is the tiny little special program which manages the sharing of resources between virtual machines. They’re often called virtual machine monitors, or VMM’s for short.
Type 1 VMM’s are often called ‘bare metal’. A Type 1 hypervisor machine is no good for anything else than running virtual machines, as that’s all it does, and it takes over the entire physical machine to do it. The plus point, here, is that that is all it’s doing, meaning the virtual machines are faster, and have more resources to play with.
Type 2 VMM’s are called ‘hosted’. Hosted VMM’s are programs which run much the same as any other program does in a normal computer. You may have heard of them – vmware and virtualbox are two I’ve mentioned before. They let an otherwise ‘normal’ computer also run virtual machines as well as doing what it normally does. The catch is that with resources in use for other programs like word processors and browsers, there’s less for virtual machines to play with.
Type 1.5 VMM’s aren’t really a class. What they are is the marriage between operating system kernels (the little programs that run in the heart of user-servicing operating systems, making them go) and the offering of virtual services. When the VMM is tied into the kernel in this way, the virtual host can offer better access to the services needed by virtual guests. It means a normal operating system has certain extra bells and whistles added on specifically for running virtual machines. In some cases, this means that virtual guests can run almost as fast (if not faster under certain conditions) than under a bare metal hypervisor.
I’ve mostly used linux, and the two most common hypervisors on Linux are xen and kvm.
Xen is a type 1. If you’ve tried running xen on your linux box, then you should know that linux was ported to xen, and not the other way around. That’s why when you’re running Xen, weird things happen – memory disappears, certain programs will chirp about permissions, perhaps, that sort of thing.
KVM is a type 1.5. KVM stands for Kernel Virtual Machine, and is a very small driver in the linux kernel itself that presents an API for virtual machines to attach to when requesting services like disk, cpu time, memory access or network packets. The 1.5 cleverness means that instead of pretending there’s a real disk, KVM can tell the virtual machine hey, just hand me that file you want to save, I’ll handle it. or instead of pretending there’s a real network card, it can tell the virtual machine yeah, just gimme that network packet, I’ll handle it.
This saves a lot of time over going through the rigmarole of fiddling with the information that the host can already deal with, and this is where a type 1.5 can be faster even than a type 1 – though most type 1 hypervisors like xen and vmware offer the same tricks.
The catch is that the guest operating systems have to know they are running in a virtual machine, which isn’t always possible. The history of virtual machines has always been one of flexibility over speed.
For a fast VM, you either need a real box doing nothing else (which renders the whole exercise pointless), a real box with special smarts (which is expensive, unless or until ‘normal’ pc’s fully support such advanced features, which will be on the twelfth of never), or you need a special VM.
Still, with modern operating systems, modifying them so they can understand they’re a virtual machine is relatively simple; it’s just a case of the right drivers.
The power of such technology means that I ran four virtual machines, each for a different purpose, on a standard computer that most gamers wouldn’t take a second look at… and thanks to another trick, inside one of those virtual machines I ran another three…