Section B.3. Running Windows Programs in Linux


B.3. Running Windows Programs in Linux

Linux is a mature OS that provides programs in all common, and many uncommon, desktop software categories. Nonetheless, sometimes native Linux programs just aren't adequate. Perhaps you need a specific program to read existing data files or to exchange data with colleagues, customers, or clients off-site. Perhaps you need a program with specific features that aren't available in Linux; or perhaps you need to run an exotic program for which no Linux counterpart is available. Sometimes, you can work around the limitation by running Windows programs from Linux. This approach has advantages and disadvantages compared to running the programs on a computer that runs Windows, so understanding why you might want to run Windows programs in Linux is critical. You should also know a bit about some of the options for doing the job; several tools are available, each of which has its own advantages and disadvantages.

B.3.1. Why Run Windows Programs in Linux?

Ordinarily, the best way to run a program is to run it on the OS for which it was designed. Any other OS will, at best, be emulating the target OS or placing an additional layer of software or protocols between you and the program you want to run. Such procedures are inevitably imperfect and often slow down operation. However, these drawbacks can be overwhelmed by certain advantages of running Windows programs in Linux:


Reduced hardware costs

Running Linux and Windows programs on one computer can reduce hardware costs compared to running these programs on multiple computers. Related to this advantage is the fact that a single computer consumes less power and desk space than multiple computers.


Using non-x86 hardware

Some methods of running Windows programs from Linux work even with non-x86 hardware. Thus, you can run Windows programs from a Linux system running on PowerPC, Alpha, or other CPUs. This may be a big plus if you already have an office filled with such computers, and you don't want to replace them or buy more.


Easy access to Linux resources

Perhaps you want to use resources available to Linux that aren't easily accessible from Windows. For instance, you might have large numbers of data files on a Linux desktop computer's hard disk, stored on a Linux-native filesystem. Although you can often gain access to such filesystems from Windows (either through special Windows filesystem drivers or by using another Windows system and setting up a file server such as Samba on the Linux system), doing so is sometimes inconvenient.


Linux stability

Linux is a very stable OSmore stable than most versions of Windows. Thus, using Linux can mean less downtime due to system crashes. This advantage is most dramatic when comparing Linux to rather old versions of Windowsparticularly Windows 9x/Me. Windows 200x has a much better reputation for reliability.


Improved productivity

Running Windows programs alongside Linux programs can improve productivity. Many methods of doing this enable you to cut-and-paste data between programs, and it's usually easier to switch between programs on a single computer than to switch between computers. If the alternative is dual booting a single computer, running Windows programs in Linux can save a great deal of time that would otherwise be wasted rebooting the computer.

These advantages all assume that you want or need to run Linux as your primary desktop OS, either site-wide or for just a few users. They tend to evaporate if you have more compelling reasons to run Windows programs than to run Linux programs.

B.3.2. Options for Running Windows Programs from Linux

Broadly speaking, methods of running Windows programs in Linux fall into two categories: remote access tools and emulators. Chapter 10 and Chapter 11 describe remote access tools. For accessing Windows systems from Linux, the GUI tools are almost certainly the better choice; text-mode tools are simply too limiting for most purposes.

Of course, using remote-access tools requires you to have at least one Windows system running on your network, and that system must be running an appropriate remote-access protocol server. You can then use the corresponding Linux client to log into that Windows computer remotely. One advantage of this approach is that you can use any Linux system, provided the appropriate software is installed; you don't need to be concerned with CPU architectures or even the speed of the computer you use for access, within broad limits. Because this approach doesn't rely on any sort of emulation, software compatibility is usually quite good. After all, the software is running on a real Windows computer, meaning that the only significant source of compatibility problems is in the protocol used to communicate between systems. Games and multimedia tools sometimes have problems running over these protocols, but most productivity tools work just fine.

Another approach is to use an emulator, which is a tool that can run one operating system's programs from another. Actually, several different types of emulators exist:


CPU emulators

CPU emulators enable one CPU to execute instructions meant for another CPU. Using a CPU emulator, you can run x86 code on a PowerPC, SPARC, or other CPU. (Emulators for other CPUs are also available but are irrelevant for Windows emulation.) You can even run x86 code on an x86 CPU using this approach. The downside is that CPU emulators can't run software nearly as quickly as it can run on native hardware of otherwise comparable speed. The most common CPU emulator for Linux is Bochs (http://bochs.sourceforge.net), which is both a CPU emulator and a machine emulator (described next). The result is that you can run Windows within Bochs. In practice, this works best with older versions of Windows on new (hence fast) CPUs. Another CPU emulator is QEMU (http://fabrice.bellard.free.fr/qemu/), which includes a full machine emulator similar to Bochs but can also be used to launch Linux applications for one architecture on another CPU. This feature can be handy for running WINE (described shortly) on non-x86 platforms.


Machine emulators

Another type of emulation is machine emulation, in which the non-CPU components of a computer are emulated. That is, software running in a machine emulator "sees" a hard disk, display hardware, and so on that are emulated. The emulated disk might correspond to a file on the hard disk and an emulated display might tie in to a single window, for instance. Machine emulators typically run emulated programs directly using the host CPU, although some tools (such as Bochs) include both CPU and machine emulator components. The commercial VMware (http://www.vmware.com) is a popular machine emulator, which supports running several versions of Windows and other OSs from Linux. Win4Lin (http://www.netraverse.com) is another commercial machine emulator, but it only supports Windows 9x/Me.


OS emulators

An OS emulator makes minimal or no attempts to emulate the CPU and hardware; instead, it attempts to emulate the OS itself. In Linux, the most popular Windows OS emulator is the open source Wine Is Not an Emulator (WINE; http://www.winehq.org). This package duplicates the functionality of the Windows application program interface (API)that is, the system calls used by programs. WINE can be used like a Linux GUI API to compile Windows programs as native programs, or it can be used in conjunction with a program loader to run programs compiled for Windows. Ordinarily, WINE is useful only on x86 or AMD64 systems; however, used with the QEMU CPU emulator, you can run x86 Windows programs on non-x86 CPUs. WINE runs Windows programs quickly (at least, when used on x86 hardware), but its compatibility is far from complete. Small programs and popular ones are likely to run well, but many large programs don't run or run only after extensive tweaking. Several offshoots of the WINE project exist. Most notable of these are the commercial Crossover Office (http://www.codeweavers.com) and the commercial Cedega (formerly known as WineX; http://www.transgaming.com). Crossover Office is optimized to run Microsoft Office and a few other common productivity tools, whereas Cedega is intended to run Windows games in Linux. The open source WINE can run Microsoft Office and many games; the commercial products provide easier installation and relatively minor improvements over the original.

The expansion of WINE's name deserves elaboration, given that I'm calling it an emulator. The precise meaning of the word emulator varies depending on who you ask about it. This appendix uses the word fairly broadly, to apply to any of the three types of activities just described. Some people, though, including the WINE developers, prefer to confine this term to CPU emulation, hence the expansion of the WINE name.


Generally speaking, among emulators, WINE is a very good approach, particularly on x86 systems, if you can get the program you want to run working under it. Check http://appdb.winehq.org for application compatibility information before you invest a lot of time in trying to get a program working. WINE provides the best cross-OS cut-and-paste support and enables you to run an application without actually installing Windows on your computer. (Some configurations do require you to copy some Windows .DLL files, however.) Note that WINE's list of supported applications is much shorter than that of machine emulators. These emulators run a real copy of Windows inside their virtual environments, so they can run almost any program that doesn't require access to real low-level hardware. (Some of these programs will work but compatibility is a bit hit-or-miss.) Generally speaking, you should resort to CPU emulators only if you must run Windows programs on non-x86 hardware. Although you can run Windows on an x86 Linux system in a program like Bochs, the experience is likely to be painfully slow, particularly if your computer is very old or if you try to run a recent version of Windows.



    Linux in a Windows World
    Linux in a Windows World
    ISBN: 0596007582
    EAN: 2147483647
    Year: 2005
    Pages: 152

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net