In the words of William Tell on his first attempt: "Oops." The week before last we threatened to discuss a system called QEMU but then last week we got thoroughly sidetracked. So without further ado, we return to our story:
The QEMU emulator , created by Fabrice Bellard, is a processor emulator that mimics any number of simulated processors and supports a variety of host operating systems.
We must digress for a moment to note that Bellard is a digital overachiever, having won not one but two awards in the International Obfuscated C Code Contest . Bellard won in 2000 for the Most Specific Output (a program to print the biggest-known prime number, 2^6972593-1, in base 10) and again in 2001 for the Best Abuse of the Rules (for an Obfuscated Tiny C Compiler for i386-linux).
Anyway, the QEMU emulator is fascinating in its range of abilities and design. A really nice feature is that QEMU is robust, an attribute that can be impressively demonstrated by making QEMU emulate itself (a technique described as "self-virtualization") by running an instance of QEMU under another instance.
It is important to note that QEMU is not a virtualization tool but a true emulator. In other words, QEMU is not making a separate, protected chunk of memory that the processor switches into and out of, but rather runs as a program that interprets the code of a supported operating system.
Given the complexity of this architecture, QEMU's code interpretation speed is remarkable. For more insight into the sheer complexity of what QEMU does and how it does it check out the QEMU Internals section .
QEMU has two operating modes: In system emulation mode, which allows you to load, run and unload complete operating systems without rebooting the host system, QEMU appears to be a complete computer system to the applications running on top of it.
This virtual computer comes with a processor, PC and VGA BIOSes, and various peripherals, including an i440FX host PCI bridge and a PIIX3 PCI-to-ISA bridge, a Cirrus CLGD 5446 PCI VGA card or dummy VGA card, a PS/2 mouse and keyboard, two PCI Integrated Drive Electronics (IDE) interfaces with hard disk and CD-ROM support, a floppy disk, an NE2000 PCI network adapter, serial ports and a SoundBlaster 16 card.
There are two versions of QEMU's system emulation mode, one which uses the host memory management unit to simulate the x86 MMU, which is fast but has limitations . The other uses a software MMU that is roughly two times slower but gives a more accurate emulation.
In system emulation mode running Linux, Mac OS X or Windows, QEMU can emulate a PC with an x86 processor or a PowerPC Reference Platform (more information ). A PowerMac system emulation apparently is in the works.
The other mode of QEMU, user emulation, runs only on a Linux host and allows you to run Linux processes compiled for one CPU on another CPU. User mode emulation provides emulations of x86, PowerPC and ARM processors, and a SPARC emulation is in test.
Bellard points out that in user mode emulation QEMU "can be used to launch the Wine Windows API emulator to ease cross-compilation and cross-debugging."