Introduction

Creating ultra fast virtual machines of old operating systems for fun and profit
Post Reply
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

Introduction

Post by MattKC »

Over the past few weeks, you may have seen some threads pop up where I'm writing a tutorial to get something known as "GPU passthrough" working on some old operating system. And as you can see, I'm getting so into doing this, I've even now set up a whole forum dedicated to it. For the uninitiated, this might all seem like meaningless gibberish, so I've decided to write about what it all means and why I'm so interested in doing it.


1. Virtual Machines

If you're familiar with emulators for old game consoles, virtual machines are essentially that for general computing (which can and often does include gaming). Old operating systems like Windows 95, XP, and even Windows 7 will struggle to run successfully on modern hardware, but by adding a layer of "virtual hardware", we can create a "virtual machine" that's guaranteed to be compatible with that OS.

For the most part this works really well. Due to the backwards compatibility of x86 CPUs, most CPU instructions can run natively on the host with minimal overhead, memory can be shared between the host and the guest, and basic hardware like network cards from the era can be emulated to provide the VM access to the outside world with the drivers the OS already has available.

However, there's one hardware component where virtual machines are severely lacking: graphics. Graphics are one of the most difficult things for a computer to do (hence why GPUs nowadays are such a significant part and cost with modern PCs), and it stands to reason that this would be true in the world of emulation/virtualization too. This in itself is not insurmountable, and some VM software does better than others, but the truth is graphics are also not usually considered a critical part of a virtual machine. The primary consumers of virtual machines are servers/datacenters and enterprise customers, where graphics are either completely unnecessary, or they only need "just enough" to get the OS to actually display. Until big corporations are actively paying money to get Need for Speed II: Special Edition running, this is unlikely to change.


2. GPU Passthrough

GPU passthrough aims to address this VM deficiency directly by... not virtualizing a GPU at all. Instead, you "pass" a real hardware GPU to the virtual machine so it can use it directly. For the guest OS, it's just a PCI-e device, same as it would be on any other computer, and it uses it accordingly.

This makes the VM very powerful. Virtualized graphics are one of the biggest overheads of a normal VM, and alleviating that allows the VM to be far more efficient. A Windows VM with a passed-through GPU is often perfectly capable of heavy processing tasks like video editing and modern video gaming that are just out of reach for normal VMs. Infamously, this also allows macOS/Hackintosh to run extremely well in a virtual machine, which is (as you'd expect) normally something Apple tries to prevent.

GPU passthrough has allowed me to fulfill a longterm dream of mine to be able to run any OS at any time without ever having to reboot and stop what I'm doing on my main OS. If there's something I need to do that can only be done in Windows, I can just fire up the VM and painlessly do it. Thanks to the GPU acceleration, it can handle everything I throw at it, so I no longer ever feel a need to run Windows natively. Likewise, if there's something I can only do on macOS (e.g. compile an iPhone app or run an Apple-exclusive app like Logic Pro), I can do that too, without the extraordinary slowness that usually comes with trying to run macOS without GPU acceleration. It's opened up the possibilities of my PC in ways that I couldn't even imagine before.

Sure having two GPUs might sound excessive, especially in this day and age, but your guest VM GPU doesn't have to be good, it just has to be... a GPU (depending on what you want to do with it). Whatever it is, it will almost certainly have better performance, reliability, and compatibility than a virtual GPU. My secondary Windows 10/macOS Big Sur GPU is an AMD RX 570, which you can buy second hand for under US$70 as of this writing (much cheaper than buying another PC/Mac!).


3. But why old operating systems?

"Okay, so I get why you might want to run modern Windows and macOS, but what's up with all this Windows XP and Windows 7 tutorials?"

So truthfully, while virtual machines have a lot of real world uses (such as the ones I listed above), the first thing that ever appealed to me about them was simply the ability to run old OSes. To relive the nostalgia of Windows 95/98, or play around with the often-derided Windows ME which I'd never seriously used before. While in some ways using VMs like this is just a bit of fun, I also believe that (much like aforementioned retro game emulation) this is a form of preservation.

Sure, you may have to be a particular kind of nerd to think software as dull as operating systems should be preserved, but I am a particular kind of nerd. OSes have always meant something to me, especially the OSes I grew up with. An OS like Windows 98 may have meant nothing to most kids growing up, but for me, I loved it. It wasn't just the thing that started whatever game I wanted to play, it was the world inside the computer. You might even say, it was my home inside the computer.

Admittedly, a lot of early versions of Windows (up to and including XP) generally virtualize fine because their UIs were software rendered (i.e. they used no GPU themselves). However, starting with Vista/7, this changed. The iconic Aero styling brought in required GPU acceleration and this has affected how well VMs are able to run them (VirtualBox in particular seems prone to glitches, but all VMs suffer performance-wise).

With old versions of Mac OS X, the situation is even worse. As alluded to earlier, Apple has implemented policies to ensure Mac OS is basically unusable on a virtual machine (since that would obviously cut into their hardware sales). In fact, up until 10.7 Lion, their official policy was to disallow virtual machine use almost entirely, only eventually acquiescing for the purposes of development/testing. Still, they refuse to allow any graphics drivers to be written for VMs, and keep their graphics driver APIs under tight secrecy so no one can write one without Apple's explicit permission (or a massive amount of reverse engineering). Like Windows, this has gotten worse as the OS has relied more and more on hardware acceleration, but even older versions of OS X (e.g. 10.4-10.6) effectively can't be emulated faithfully. Your only choices are to use old/original hardware, or to pass through a GPU that Mac OS is compatible with.

This is where my preservation argument comes in. If there's no real way to replicate a software experience without original hardware, well, that experience isn't really preserved at all. When that hardware dies, there will simply be no way to relive that, and to me that would be extremely sad. Of course, passing through a real GPU does tie this into some hardware, but it's only one failure point as opposed to an entire computer.

Running an old OS with a passed through GPU results in a VM that's not only fully accurate and compatible with said OS, but also extremely performant. While it may have an older GPU, the CPU/RAM/SSD/buses/etc. are likely significantly better than any real hardware the OS is able to run on. In some ways, this may in fact make this the best way to run these OSes, or at least the fastest.

Windows 7 has been in the news recently due to losing extended support from Microsoft, and this made me curious whether I could get a faithful Windows 7 setup at my disposal. Once I learned that I could, I decided I'd try to figure out as many as I could, to get as many near-native OS experiences available to me as possible.


4. Current Progress/Index

The following is a list of operating systems I have or want to get working. Of course, real preservation means we can all set one of these up, not just me, so for each one I'll be writing a tutorial showing exactly how I set it up. If you're interested in this sort of thing, you can do it without having to break the bank. A lot of the old GPUs useful for this sort of thing are available for as little as $5 incl. shipping on eBay! Later on, I'll make a writeup about which old GPUs are best for which old OSes.

This is obviously not an exhaustive list of OSes, only the ones I feel need preserving (Linux distros aren't included because open source makes them easy to run on anything) and that I feel realistically have a chance at running (OSes that pre-date PCI-e GPUs are not included).

All VMs are using QEMU/KVM, usually with virsh/virt-manager but that's not required.

Key:
  • Red means I haven't achieved this yet
  • Yellow means I've had some success but not complete success yet
  • Green means I've found a reliable way to get this working
Windows
  • Windows 2000
  • Windows XP (guide)
  • Windows Vista (guide)
  • Windows 7 (guide)
  • Windows 8.x
  • Windows 10
  • Windows 11
Macintosh
  • Mac OS X 10.4 Tiger
  • Mac OS X 10.5 Leopard
  • Mac OS X 10.6 Snow Leopard (guide)
  • Mac OS X 10.7 Lion
  • OS X 10.8 Mountain Lion
  • OS X 10.9 Mavericks
  • OS X 10.10 Yosemite
  • OS X 10.11 El Capitan
  • macOS 10.12 Sierra
  • macOS 10.13 High Sierra
  • macOS 10.14 Mojave
  • macOS 10.15 Catalina
  • macOS 11 Big Sur
  • macOS 12 Monterey
  • macOS 13 Ventura
Post Reply