The Features and Limits of Emulation

Three main types of emulation are available in Linux:

CPU Compiled software uses machine code that runs on only one CPU or CPU family, such as IA-32, IA-64, or PowerPC. If you want to run, say, an IA-32 executable on a Macintosh (which uses a PowerPC CPU), you must have software that translates the IA-32 CPU instructions in the executable to PowerPC instructions. This task is akin to interpreting the instructions in a script. Such emulation tends to be time-consuming, which substantially degrades performance.

Machine Environment In addition to the CPU, computers have a host of hardware devices—video cards, hard disks, Ethernet interfaces, and so on. Linux takes full control of these interfaces, which means that to run another OS within Linux, some sort of indirection is necessary—that is, the emulator must present a fake hardware environment for the "guest" OS to use. Setting up this indirection is tricky from a programming point of view. It's also time-consuming, but not nearly as time-consuming as CPU emulation.

System Calls Instead of running an entire guest OS within an emulator, you can create an environment of system calls that duplicate those of the emulated OS. This task is quite daunting in itself, but the challenges are different from those of CPU or machine environment emulation—instead of setting up a fake hardware environment that can fool software, a replacement software environment is required.

CPU emulation is most often used to run Macintosh programs on an IA-32 system, to run an IA-32 OS on a Macintosh, or to run software for older computers (such as Apple lis, Ataris, or Commodores) or game systems on a desktop computer. Machine environment emulation lets you run an arbitrary OS for the same CPU that your computer has under Linux. Most commonly, you'll run Windows under Linux, but other options are available, too. A system call emulator can handle just one OS (Windows is the most common one). In theory, system call emulation can be slightly faster than machine environment emulation. In practice, the need to create a reimplementation of Windows without access to the original Windows source code makes system call emulation very difficult.

The main Linux system call emulator is WINE (Windows Emulator or WINE Is Not an Emulator, depending on who you ask). It does a good job with some programs, but a poor job with others. Machine environment emulators tend to run a broader range of programs, but they can be more limiting in terms of access to your Linux system. For instance, WINE uses the Linux filesystem, so you can load and save files in your Linux home directory as if you were using a native Linux program. Machine environment emulators, by contrast, generally use partitions or large files in which the emulator sets up a filesystem. You must use networking to save files in the Linux filesystem. (Win4Lin is an exception to this rule.)

You can use an emulator to run popular Windows or Mac OS programs such as Microsoft Office or various Windows games. Some games, though, use advanced video driver features that the emulators don't support, so some games don't work well (or at all) in an emulator. You should definitely check the emulator's website for information on whether any important programs you want to run will work. You may also need a fast CPU (especially for CPU emulators), lots of disk space, and a substantial amount of spare RAM, particularly for CPU and machine environment emulators. You may need to jump through a lot of hoops to use certain external peripherals, such as modems, printers, and scanners, and some may not work at all. Networking might or might not work well. Some CPU and machine environment emulators rely on nonstandard kernel drivers, so you may need to patch and recompile your kernel to use them.

0 0

Post a comment