From DSL Wiki

QEMU is free software written by Fabrice Bellard that implements a fast central processing unit|processor emulator, allowing a user to run one operating system within another one. It is similar to projects such as Bochs, VMware|VMware Workstation and PearPC, but has several features these lack, including increased speed and support for multiple architectures. By using dynamic translation it achieves a reasonable speed while being easy to port on new host CPUs. QEMU has two operating modes:

  • User mode emulation: QEMU can launch Linux processes compiled for one CPU on another CPU. Linux system calls are converted because of endianness and 32/64 bit mismatches. Wine (software)|Wine and Dosemu are the main targets for QEMU.
  • System mode emulation: QEMU emulates a full system, including a processor and various peripherials. It enables easier testing and debugging of system code. It can also be used to provide virtual hosting of several virtual PCs on a single server.

The majority of the program is under the LGPL, with the system mode emulation under the GPL.

Fabrice Bellard also wrote a closed source, currently free-of-charge, Linux kernel module (with preliminary ports to FreeBSD and Windows) named kqemu or QEMU Accelerator, which speeds up i386 emulation on i386 platforms to a level where the loss of speed is negligible even compared to native execution. This is accomplished by running user mode and virtual 8086 mode code directly on the host computers CPU, and using processor and peripheral emulation only for kernel mode and real mode code. This is similar to what VMware Workstation and Virtual PC do. As a result, real mode DOS will not speed up much if at all as a guest OS, whereas Windows 2000 will run at close to native speeds. (Lets note however that as soon as a memory manager is used with DOS, most of DOS code is actually run in a virtual 8086 mode task, and should theoretically benefit from kqemus speedup.)


Advantages of QEMU

  • Supports emulating IA-32 (x86) PCs, x86-64|AMD64 PCs, MIPS R4000, Suns SPARC sun3 and PowerPC (PReP and Power Macintosh) architectures
  • Support for other architectures in both host and emulated systems (see homepage for complete list)
  • Increased speed—some applications can run in close to real time
  • Support for running Linux binaries for other platforms
  • Can save and restore the state of the machine (programs running, etc.)
  • Virtual network card emulation

Disadvantages of QEMU

  • Incomplete support for Microsoft Windows and other host operating systems (emulation of these systems is just fine)
  • Incomplete support for less frequently-used architectures
  • Used on x86, it still isnt as fast as a virtual machine such as VMware, unless using the kqemu accelerator
  • More difficult to install and use than comparable emulators

Example of QEMUs usage

This command will create a 500MB hard disk image in QEMUs "qcow" format.

qemu-img create -f qcow c.img 500M

The following command will start a virtual machine with 128MB of memory, using the c.img file created with the previous command and booting from a CD-ROM image linux.iso. The virtual machine will have audio support and use the systems clock to run in "real time." Note that one could also replace the -cdrom linux.iso parameter with -cdrom /dev/cdrom or whatever ones CD-ROM device is, and physically boot from installation medium and install to the image specified after -hda, in this case c.img.

qemu -hda c.img -cdrom linux.iso -boot d -m 128 -enable-audio -localtime

This will create a virtual machine with 64MB of memory, booting from c.img and using the systems CD-ROM drive. The virtual machine will run in full-screen mode.

qemu -hda c.img -cdrom /dev/cdrom -boot c -m 64 -full-screen

While a virtual machine is running, press Ctrl-Alt-2 to access the "QEMU console", which lets one control the virtual machine (for example, changing disk images, rebooting, quitting QEMU, etc.) and Ctrl-Alt-1 to switch back to your emulation. Ctrl-Alt-F toggles between full-screen and windowed mode.

kqemu versus QVM86

Originally, kqemu was proprietary and closed-source, while qemu was free. QVM86 was developed by another party to perform the same task as kqemu, but as free code. kqemu has since been licensed under the GPL.

qemu, kqemu, and QVM86 are now all freely licensed under the GPL.

See also

External links