Back in the days of yore when I wrote "From iPod to MacBook Pro: A Switcher's Tale" (you know, a month ago) I described how my primary personal justification for investing in a MacBook Pro was the possibility of eventually running Windows on my Mac desktop. I'd be able to work in the wonders of Mac OS X while still being able to access my corporate applications keeping me chained to Windows. I even predicted (boldly, some readers said), that it would be only a matter of months before we saw Windows on Macs.
<http://db.tidbits.com/article/08455>
I was wrong. It was only a matter of weeks.
Since my earlier article there's been significant progress in the field of running Windows on Intel-based Macs. Around the same time, a pair of hackers won nearly $14,000 for producing a repeatable method of dual-booting Windows on a Mac, and a universal binary version of Q emulation software appeared, enabling users to run Windows and Unix variations in emulation windows on the Mac desktop. Then, before the ink was dry on that $14,000 check, Apple released the Boot Camp beta version for official dual booting (see "Apple Opens Boot Camp for Windows Users" earlier in this issue).
<http://onmac.net/>
<http://www.kberg.ch/q/>
<http://www.apple.com/macosx/bootcamp/>
It seems obvious that much more emphasis is focused on enabling dual booting over virtualization. Apple considered it important enough to dedicate resources to it and to release beta software while over 850 companies and individuals donated hard cash to the effort. But I see dual booting Windows on a Mac as merely a temporary solution, one that will fade to minor importance as we get full virtualization running in a hypervisor environment on Macs. Instead of exiting Mac OS X, rebooting and loading Windows XP (which will take longer than the current 23 seconds to boot Mac OS X on my MacBook Pro), running whatever application you need and then shutting down and transitioning back, you'll be able to run an instance of Windows XP within a window in Mac OS X, with very little performance degradation and support for nearly everything you need. Heck, I'm running a slightly crippled version of that exact scenario right now! But before we pit dual booting and virtualization in mortal combat, it's important to understand what virtualization and emulation are, what obstacles they face, and the potential long-term benefits.
Defining Our Terms -- In short, a "hypervisor" is virtualization software that makes it possible to run multiple operating systems on a host computer. It does this by emulating a hardware environment for the guest operating system to run in, and we call this a "virtual machine." True hypervisors layer themselves between the host operating system and the physical hardware to maximize performance by minimizing any layers between the virtual machine and the hardware underneath.
Now for the long version. "Virtualization" is a bit of a loaded term with a number of potential meanings, so we need to narrow the field down a bit. For the purposes of this article I'm going to focus on virtual machines and application virtualization, and I apologize in advance for grossly oversimplifying. Whenever you abstract something, which means having some bit of code pretend to be a piece of hardware, it's a form of virtualization. In fact, you're already using quite a bit of virtualization technology on a modern Macintosh. Virtual memory is perhaps the most obvious use of virtualization - it uses space on the hard disk to simulate RAM. Multiple partitions on a single physical hard drive, disk images, a single partition spanning multiple physical drives (like a RAID) and even your iDisk are all virtual disks. The Java programming language is built on the concept of programming applications to run in a Java virtual machine - a software environment abstracted from the physical hardware of a system. Even those nice Flash animations use application virtualization.
"Emulation" is closely related to virtualization. With emulation we use software to emulate the response of incompatible hardware. The most well-known example of this is of course Virtual PC, which enables a PowerPC-based Mac to run Windows software by emulating the x86 hardware. Rosetta is also emulation software - when a PowerPC application runs on an Intel-based Mac, the Rosetta code translates instructions for a PowerPC processor into instructions for an x86 processor, then translates the results back to the application. That's why PowerPC applications run slower in Rosetta - every instruction to the CPU must be translated in both directions. Another, more entertaining example of emulation is MAME (Multiple Arcade Machine Emulator), which is software that emulates arcade games and gaming consoles so you can play old arcade games on your computers.
<http://www.microsoft.com/mac/products/virtualpc /virtualpc.aspx>
<http://www.apple.com/rosetta/>
<http://www.mame.net/>
But the most exciting area of virtualization (and emulation) today is virtual machines and hypervisors. This time we're not talking about the limited application environment of a Java virtual machine, but running a complete host operating system within another operating system. The most famous examples of this are VMWare, Virtual PC for Windows, QEMU, and Xen. Each operates a bit differently, but all essentially create a virtual machine into which you can install a different operating system, regardless of the host hardware and operating system (as long as it's supported).
<http://www.vmware.com/>
<http://www.microsoft.com/windows/virtualpc/>
<http://fabrice.bellard.free.fr/qemu/>
<http://www.cl.cam.ac.uk/Research/SRG/netos/xen/>
We call the software that manages this process a "virtual machine manager" or "hypervisor," the system running the virtual machine the "host operating system," and the system running inside the virtual machine the "guest operating system." Thus we create a virtual machine by emulating the hardware needed for the guest (that's what hypervisor software does). This leads to some interesting results. One of the best results is that virtual machines are portable, since they aren't tied to the host hardware. I have a couple of Windows XP virtual machines in various stages of patches that I move from computer to computer merely by copying the image file over. In an enterprise environment this means you can have highly portable standard images, which is nifty if you manage a lot of servers. We can also run multiple virtual machines at the same time on a single system, in some cases emulating entire networks with workstations and servers. I've run up to three virtual machines in VMWare on my Dell Pentium 4 2.4 GHz computer and the biggest limitation is memory.
Of course, that's not the case with Virtual PC on a Mac, where Windows performance is, frankly, mediocre at best. The performance problems stem from having to emulate the x86 processor architecture on top of Mac OS X while running a virtual machine. We're talking multiple layers of translation here and a layer of emulation across two operating systems and different hardware, which is not the best combination for good performance. But those of you who may have also run VMWare, Xen, or QEMU on x86 probably noticed much better virtual machine performance. That's because those tools play tricks to minimize the translations needed and allow processor commands more direct access to the hardware underneath.
VMWare tends to pass CPU calls directly to the processor while emulating the rest of the hardware environment (video, peripherals, etc.) that might change from system to system. Thus we eliminate much of the translation (and some of the emulation) needed and our guest operating system runs at near-native performance. These benefits don't translate for system components that are fully emulated, like video cards, so VMWare is more suited for business applications than the latest version of Unreal Tournament. Whereas VMWare is commercial software dedicated to the x86 architecture, QEMU is open source and capable of emulating and running on a few major hardware platforms, including PowerPC-based Macs. In some cases, and now we're back to x86, programmers developed accelerators similar to VMWare to speed up performance by skipping some of the translation. Xen, another open source virtualization tool, takes it a step further and relies on highly optimized guest operating systems to achieve essentially native performance.
Into the Ring -- Back to the smackdown. Now that Macs run on Intel x86 processors we have two options for running Windows. We can dual-boot the machine and just run Windows natively, or we can run Windows in a virtual machine that's running in Mac OS X. Each has advantages and disadvantages, but my preference is virtualization, and I have it running today.
My goal is to use my MacBook Pro as my primary system when I travel, which means running just a few Windows applications, including our corporate VPN, corporate dial up networking, and Outlook (I need to keep my .pst files, so Entourage isn't an option). I'd rather run this within Mac OS X if possible, but dual booting will at least buy me time. I first looked into the dual-boot process published by OnMac.net, but it was pretty labor-intensive and prone to error. I figured I could always come back to it if necessary.
Luckily, Apple's public beta of Boot Camp is an official, user-friendly, dual-boot installer and manager. As many of you know by now, the Intel-based Macs use EFI (Extensible Firmware Interface) instead of BIOS (Basic Input/Output System) for the firmware, but EFI works only with Mac OS X for now (Windows Vista will support EFI too). Thus, creating a dual-boot Mac is not as simple as installing Windows and Linux on the same PC; we need some sort of emulator to pretend to be BIOS and allow the operating system to load. Boot Camp seems to do that seamlessly along with repartitioning your hard disk on the fly and creating a CD of drivers for all the nifty Mac hardware that's not yet supported in Windows. Simple, easy, reliable, and not all that interesting for me personally, especially since none of my half-dozen Windows XP install CDs meet the Service Pack 2 requirement. (If you're in the same situation, it is possible to build a Windows XP SP2 installation CD from the original XP CD and the downloaded service pack, assuming you have access to a Windows machine and some technical chops.)
<http://www.winsupersite.com/showcase/windowsxp_ sp2_slipstream.asp>
So I decided to move on to virtualization. The open source QEMU can now run on either PowerPC- or Intel-based Macs, and there is a wonderful Mac OS X port of QEMU called Q, with all sorts of Aqua goodness. QEMU on a PowerPC-based Mac suffers from the same performance limitations as Virtual PC but theoretically could be enhanced on the Intel Core Duo Macs for greater performance.
My initial attempts at using Q gave mixed results. I downloaded and installed Q as instructed. First, you're supposed to create a disk image to install your new operating system. Then you have to launch the virtual machine and tell it to boot off your installation CD, just like installing on real hardware. I inserted my old Windows XP Service Pack 1 CD into the MacBook Pro, launched Q, configured it to boot on the local CD-ROM drive and... nothing. Reading the support forums confirmed that I was doing everything exactly right. So I tried creating a disk image of the Windows install CD and using that instead and... nothing again. Frustrated to no end, I tried a good old fashioned reboot, launched Q again, and it all just worked. I was up and running and the install process was no different than any other time I installed Windows, although it slogged like using an old 386 processor instead of a Core Duo. The install completed normally, I switched Q to boot off the virtual hard drive instead of the system CD, and there it was - the Windows login screen on my Mac desktop.
The first thing I tried to do was install our corporate VPN client (like many businesses we don't use standard IPsec for manageability and security reasons). This is the single most important step to meet my goal of shelving my corporate PC. Unfortunately, I encountered a fatal memory error that wouldn't disappear after multiple reboots. Upgrading to Service Pack 2 didn't help, nor did creating a Windows XP virtual machine in QEMU on my PC (in fact, the version running on my PC crashed even harder when trying to run the VPN client).
Without our corporate VPN client, my Q experiment was essentially a failure, though I went on to install Microsoft Office and test Outlook. Everything worked fine, if slowly. I could transfer files between Mac OS X and Windows easily with a shared folder, access the Internet, and install software - just not all software. I've used a fair number of virtualization packages and while Q is slow, it's usable in a pinch. Barely. That will change, of course. A group of QEMU programmers are feverishly working away at kernel extensions to provide the Mac version with the same speed benefits as running on Windows.
But last week saw more than just Boot Camp, since Q was joined by another virtualization program, this time from Parallels Software. The public beta of Parallels Workstation 2.1 for Mac OS X promises near-native performance for any version of Windows (not just XP), any Linux distribution, FreeBSD, Solaris, OS/2, eComStation, or even MS-DOS.
<http://www.parallels.com/en/products/ workstation/mac/>
I have now completed installation and testing of Parallels Workstation with a Windows XP virtual machine. I'm happy to say that with it, virtualization is real, - and really fast - on Intel-based Macs today. Parallels Workstation installed without a hitch, and I quickly created a Windows XP virtual machine. I was able to patch it to Service Pack 2, and it accepted my corporate VPN. I'm now happily connected and running Outlook as if I was on the corporate network. And did I mention that it's fast? Taking advantage of Intel's Virtualization Technology results in extremely solid performance that's faster than VMWare on my PC and possibly faster than my work PC. While I haven't tested advanced graphics yet, I think it's safe to say that thanks to Parallels, we have full virtualization on the Mac with better performance than some PC solutions. Heck, I've even already filled up my virtual hard drive with the Windows software I need to use on a regular basis.
Pick Your Poison -- For those of you thinking of running Windows on your Intel Mac, here's a rundown of your options with my personal recommendations.
If you are interested in gaming or other high performance software, or need immediate full support of Windows, go with Apple's Boot Camp. You'll need to reboot to switch between Mac and Windows, but it works and will always be the best option if you need to push every bit of performance out of that video card.
For those of you, like me, that just need a few Windows applications to get your job done and don't feel like rebooting, virtualization is the way to go. Parallels seems rock solid, but if you want open source, Q should offer respectable performance in the near future. I expect to see additional offerings from VMWare, Microsoft, and possibly even Apple down the road.
What does the future hold? While virtualization is here today, it's not inconceivable that we could see Rosetta for Windows on a Mac in the more distant future. This would mean that instead of running Windows inside a window, you could run an individual Windows application much as you do with Classic applications on PowerPC-based Macs today.
I don't see this as a priority for Apple, but there are no technical reasons why it shouldn't be possible. It's a difficult problem, and I'm not sure it makes business sense for Apple, but it's been done to a certain degree already on Linux with the WINE project (which isn't emulation, but implementation of Windows APIs).
One thing is certain: Windows and Macs are much closer than they were a few months ago. And maybe, just maybe, we Mac types will be able to use our favorite computers at work without battling corporate IT.