search technology reviews, news, features, group tests
Popular Searches:   video , dell , dvd
 |  Register
 |  Newsletters  | 
Sitemap  |  RSS
RSS
Monday November 23, 2009 1:14 AM AEST
Skip Navigation LinksPC Authority > Features > RWC: Linux: Windows in a box
FEATURE

RWC: Linux: Windows in a box

by Staff Writers  on Jul 13, 2004
Tags: RWC | Linux | Windows | in | a | box
Run Windows apps on Linux by running Windows itself. Leigh Dyer shows you how.

Over the past two months I've been showcasing some of the best Linux desktop environments available today, and I hope I've shown that Linux is rapidly becoming capable in both home and corporate desktops. With applications like OpenOffice, Evolution and Mozilla Firefox, Linux is becoming more competitive in offering alternative working environments. However, many users need to go beyond these common tasks, running specialised applications in fields like accounting and content creation. Until the Linux market grows large enough to demand native ports of these applications, it's clear that many people are stuck with a need to run Windows applications.
Thankfully, there are ways to run those legacy applications on your Linux desktop. The most common solution is probably Wine (www.winehq.com), which re-implements the standard Windows libraries, letting you run many Windows apps directly under Linux. It works well for many common applications, but often comes unstuck with more specialised or complex applications. The only way you'll get these running on Linux is to run Windows itself, inside a PC emulator.

An emulator is an application that recreates a piece of hardware, such as a computer or games console, in software. If you look hard enough, you'll find an emulator for just about every system imaginable, from the Commodore 64 through to the GameBoy Advance. PC emulators recreate an entire PC in software, including the CPU, RAM, hard drive, CD-ROM drive and network and video cards. Inside the emulator you can do just about anything you could do with a real PC, letting you run a complete Windows system on your Linux desktop.

The classic PC emulator is Bochs (http://bochs.sourceforge.net), which started life as a commercial open source application for UNIX systems. In 2000, MandrakeSoft bought the rights to the code and re-released it under the LGPL licence, leading to more widespread acceptance and a renewed interest in development. It can run many operating systems, including Windows, but unfortunately its performance is quite poor.

Bochs uses a CPU emulation known as an interpreter, where instructions for the emulated CPU are interpreted and executed on-the-fly. This style of emulation is both portable and relatively easy to develop, allowing Bochs to run on various operating systems and hardware platforms. However, interpreting instructions one at a time is very time consuming, which means that a Bochs emulated system runs several hundred times slower than the PC it's running on. Unless you have both a fast machine and a lot of patience, you'll likely find that Bochs is simply too slow to run a usable Windows system.

For better performance, the best option is VMware Workstation (www.vmware.com), a commercial, closed-source PC emulator. Instead of emulating a CPU, VMware uses a technique called virtualisation that effectively splits your CPU into multiple virtual CPUs, allowing it to run many operating systems at once. This gives VMware performance quite close to that of the underlying hardware. In fact, when running Windows in full-screen mode on a fast PC, most people wouldn't realise that they're actually sitting in front of a Linux box.
VMware has many other neat features, including bridged networking that connects your virtual PC directly in to your LAN, and support for USB, SCSI, serial and parallel port devices. The only clear technical downside is that it's limited to x86 systems, but that won't be an issue for most people. For companies looking to run legacy Windows apps on Linux desktops, VMware is the ideal solution, but for home users looking to run the odd Windows program, the US$189 price may be too high.

Thinking outside the Bochs

There's now a second open source option for PC emulation, a newcomer called QEMU (http://bellard.org/qemu/). In the last 18 months, QEMU has gone from a proof of concept to a basic but functional PC emulator that already provides better performance than Bochs. It's still in the early stages of development, so it's a bit experimental. QEMU doesn't reach near VMware's level of performance yet, but it's already quite usable.
QEMU achieves better-than-Bochs performance through an advanced emulation technique known as dynamic recompilation. Instead of interpreting instructions one-by-one, QEMU quickly translates entire blocks of emulated code, caching the results for later reuse. This dramatic reduction in the amount of translation work gives the CPU more time to actually run the emulated code, resulting in a big performance boost.
Dynamic recompilation has been used before in other emulators, and in virtual machines for Java and .NET, but such emulators usually have to be written for a specific host CPU. However, QEMU's developers have created a portable dynamic recompilation system, which means that QEMU runs just as well on a PowerPC Linux machine as it does on a normal Linux PC. It also runs on Windows, and should soon run on Mac OS X.
Beyond the CPU, QEMU emulates a VGA card, an IDE controller with CD-ROMs and hard drives, and an NE2000-compatible network card. All of this hardware normally runs on an ISA bus, but QEMU recently added an experimental PCI mode that puts everything on an emulated i440FX PCI bus. PCI mode isn't quite as solid or compatible as ISA mode yet, so for the moment it's best to stick to ISA mode when installing Windows.
QEMU doesn't have a nice GUI so far, but getting it set up and running is still fairly simple. You can grab both source and precompiled binaries from the QEMU website, or if you're feeling adventurous, you can grab the latest bleeding-edge code from CVS. Building from source is usually pretty easy, using the familiar configure/make/make install sequence, though you might like to give the following option:


--target-list=i386-softmmu

This will configure the script when you run it to limit the build to the generic PC emulator. QEMU includes various other emulators, including an experimental PowerPC system emulator, but we'll stick with the standard PC emulator for now.
Setting up a virtual machine requires a few manual steps, but there's nothing too tricky involved. First, you'll have to create a disk image for QEMU to use. If you've got Bochs installed you can use its handy bximage command to create a raw disk image, but the easiest way is with the standard dd command:


dd if=/dev/zero of=disk.img bs=1048576 count=2000

This will generate a blank 2GB file called 'disk.img', perfect for installing Windows into. On the subject of Windows versions, we've found that Windows 2000 seems to work best, though if you find it's a little slow, certainly give Windows 98 or even 95 a try. With our Windows 2000 CD inserted, it's time to fire up our virtual machine. QEMU takes a series of options on the command line rather than using a config file, so you'll need to launch it with a command like this:


qemu -m 128 -hda disk.img -cdrom /dev/cdrom -boot d

This runs a virtual machine with our hard drive and 128MB of RAM installed, and the Windows 2000 CD inserted and set to boot. After a brief glimpse of the BIOS POST screen, the system boots from the CD and starts the Windows 2000 installer. From here, installing Windows is really no different to installing it on a real PC, though it'll take a bit longer than you might be used to. When the system reboots as part of the install process, QEMU closes itself, so you'll have to keep an eye on it and restart it after any reboots.
The emulated display appears in a window, as you&

This article appeared in the August, 2004 issue of PC Authority.
Email a Friend Email this
Print Page Print this
Tweet This Tweet this
Feedback Send us your tips


Ads by Google

Comments

Be the first to comment on this article.
Thoughts on this article? Add a comment below.
Login or register to submit a comment.
 

Top Stories

Box battle: Telstra takes on TiVo and Foxtel with T-Box trial in Melbourne
It's not quite Foxtel IQ and it's isn't TiVo either. The T-Box lets Telstra users watch movies and TV from the Bigpond site, as well as record and watch digital TV
 
5 More Free Linux Apps You Can't Do Without
More digital Swiss Army knife software, including Linux utilities and tools that are so useful you won't know how you ever did without them
 
Microsoft delivers Office 2010 public beta
Vendor details editions for Office 2010 along with application virtualisation for testing.
 


 
Intel
 
 
LogMeIn
 
 
Amazing Dell Coupons now available
 
Discover Apple