What is QEMU?
This time on our tour of virtualization technologies we shall be looking at QEMU, or the Quick EMUlator. Unlike many modern virtualization systems, as the name implies QEMU is an emulator, and as such is capable of emulating many systems and hardware components.
QEMU Emulation Virtualization
Whilst virtualzation systems such as Xen and KVM rely on partitioning up the resources of the host computer for the various guest operating systems to use, QEMU emulates another system. Emulation involves software acting as an interface between the guest system and the real hardware. From the standpoint of the guest, the emulator presents all the interfaces of the hardware that it would normally see on the system being emulated. Instead of the code executed by the guest being directly executed on the underlying hardware, the emulator interprets the instructions for the emulated system into instructions that the underlying hardware can execute. This means that through the process of emulation, software for one system can be run in an emulator running on incompatible hardware.
There is a cost in terms of system overheads on the host for a system to be emulated. This means that the host system will need to be more powerful than the guest system being emulated for the guest to perform at any usable speed. Due to this cost, emulation is commonly used to allow for the use of software for which the original hardware is hard to obtain or buy. Just as with running a guest on compatible hardware with the host’s, so virtualization through a hypervisor can provide much better performance.
QEMU Emulation: Hardware Platforms, Peripherals and User-Mode
QEMU is capable of emulating a number of different hardware platforms, including the x86 PC, PowerPC platforms such as the PowerMac, ARM based systems such as the Nokia N800 and Palm Tungsten|E PDA, and also SUN SPARC systems. In addition to the core hardware of these systems, QEMU also provides emulation of a number of different add-on modules such as graphics cards, sound cards, network devices, storage devices and controllers, serial/parallel/USB devices and memory devices. This means that in many cases complete and fully operational computers can be emulated and used to run their original software.
Due to its ability to emulate a range of peripherals, QEMU is often used in conjunction with the XEN and KVM hypervisors in order to provide virtual machines with the ability to interact with the emulated peripherals, providing features such as networking and sound that may not otherwise be available through pure virtualization. In these scenarios QEMU simply provides the emulated hardware interfaces for these peripherals, leaving the management of code execution of the guest system to the hypervisor itself.
An interesting additional feature that is available through QEMU is the ability to perform user-mode emulation. This means that QEMU can allow the operating system to run software that may have been compiled for a different hardware platform, rather than emulating a full system including operating system. An example of this would be running a software binary for a 32bit ARM Linux system on a 64bit x86 Linux system. This is a limited feature though, as while QEMU can run on Linux, Windows, UNIX and macOS, this feature is only available to Linux systems and some UNIX ones.
Snapshot Disk Images
Another handy feature is the ability to use snapshots of the disk images. When a snapshot image file is created, future changes to the disk image are written to the snapshot image, while the original disk image file is kept loaded as read only. This means that if at any time you wish to return to the original disk image after making changes, the original image can be accessed and booted from. However, once any changes are made to that original image, the snapshots made from it will no longer be usable.
As with many Linux based tools, QEMU is controlled through a command line interface which can make some usage unintuitive and complicated with the large number of available options. Fortunately, there are tools available – such as Virtual Machine Manager – to provide a graphical interface that makes things easier to get started.