Emulation, Virtualization, and More

When it comes to running non-Linux software or a second operating system under Linux, many users turn to a commercial solution such as VMWare (http://www. vmware.com), or a full-blown virtual machine, or CodeWeavers' CrossOver (http://www.codeweavers.com/products/ crossover). But the open source world has a lot to offer, too.

When it comes to running non-Linux software or a second operating system under Linux, many users turn to a commercial solution such as VMWare (http://www. vmware.com), or a full-blown virtual machine, or CodeWeavers’ CrossOver (http://www.codeweavers.com/products/ crossover). But the open source world has a lot to offer, too.

This month, let’s look briefly at several open source projects that let you run Windows applications on Linux, or multiple operating systems at the same time.

API Support: WINE

Bob Amstadt began WINE in 1993 as a way to run Windows 3.1 programs on Linux. In the last 10 years, it’s come a long way, and now serves as the foundation of the CrossOver product.

The WINE project (http://www.winehq.com) provides the infrastructure required to run a variety of 16- and 32-bit Windows applications on Linux without having to install Windows. WINE simply re-maps Win32 API calls to Linux equivalents. The process isn’t much slower than running applications on Windows natively, but it sure beats dual-booting or having a second computer just to run the occasional Windows program. If you need to run Excel or Word a few times each year, it’s hard to beat WINE.

Virtualization: Plex86

Plex86, like VMWare, follows in the tradition of IBM mainframes: both Plex86 and mainframes use the capabilities of the underlying hardware to provide one or more virtual machines, where each virtual machine can run the operating system of your choice. Virtualization isn’t a new technology, but only in recent years has PC-class hardware become powerful enough to make running virtual machines worthwhile.

Virtualization is not emulation — the virtual machines are all running on the real hardware. However, being tied to the CPU means that there’s little portability. If you’re running on Intel hardware, you can only run other Intel-compatible software. You can’t use virtualization to install Mac OS X on your Pentium-based computer. However, with Plex86, you can use the raw horsepower of that new 2.4 GHz Pentium 4 to run Linux and Windows at the same time.

You can download Plex86 from its SourceForge home page at http://plex86.sourceforge.net. The project’s home page mentions that Plex86 can be used to run Linux inside the Plex86 virtual machine (with only minimal changes to build a suitable Linux kernel), and that you can combine Bochs (described next) and Plex86 to accelerate Bochs.

Emulation: Bochs

At the other end of the spectrum is Bochs (pronounced “box”). Bochs provides a fully-emulated environment in which you can install and run a new operating system. Unlike Plex86, Bochs is all software emulation. It runs quite a bit slower, but it’s portable. You can run Bochs on Linux, Windows, Mac OS X, Mac OS 9, and BeOS. Of course, Linux and Windows are the most popular and best-supported.

Since Bochs may be running on hardware (such as a Mac) that bears little resemblance to the hardware you’d like to emulate, there’s a lot more going on behind the scenes. Bochs provides an emulated BIOS, network card (NE2000), sound card (SoundBlaster 16), disk controllers, and so on.

Getting started with Bochs is easy. On the Bochs project web site, you’ll find pre-built disk images that you can download to begin using a new operating system right away. If you’ve ever wanted to try OpenBSD or NetBSD, simply download the disk image, configure Bochs to boot from it, and you’re up and running a new OS.

Linux on Linux: User Mode Linux

User Mode Linux (UML) is a special-purpose Linux kernel that’s capable of running in user mode under a normal kernel (just like vi, Mozilla, or any other application). However, UML provides a full-blown kernel under which you can test new software in a safe, sandbox environment. Since UML runs as a normal user, having root access in UML is limited to the permissions of the user who launched UML.

A virtual machine in UML feels just like a normal Linux instance. It has its own virtual filesystem, devices, users, network ports, and so on. UML comes with a small collection of tools to provide network and serial device connectivity between the host kernel and the UML instance.

UML was originally used only among kernel hackers, but lately it’s become a popular way to test new or “untrusted” software. It’s also used an alternative virtual hosting environment — one in which each user gets root access to their own virtual machine.

Do you have an idea for a project we should feature? Drop a note to diy@linux-mag.com and let us know.