Monday, November 5, 2012

Adventures with WINE

WINE is not the kind you drink. It is, instead, an expansive Windows quasi-emulation layer for Linux and UNIX-like operating systems. Although the 'E' stands for "Emulator", the developers prefer to avoid that word because WINE doesn't strictly emulate anything in a formal sense. Instead, it creates an environment which is binary-compatible with Windows from the ABI and API on up. There is no machine virtualization. The Windows binaries are loaded into memory using a custom loader, and they execute natively on the CPU just like a UNIX binary, but with a ton of dynamically-linked shims and supporting libraries.

Just as impressive is that this all happens entirely in host userspace. WINE simply maps Windows functionality to corresponding UNIX actions using libraries which take the place of native Windows counterparts. So, for example, WINE's gdi32.dll has most of the expected Windows drawing functions, but instead of calling the NT Kernel to draw to the screen, it performs the equivalent tasks by calling the X server. The Windows application thinks it's running in Windows because it sees Windows interfaces, but those interfaces accomplish their jobs in a completely different way than Windows.

It might be an apt analogy to say that WINE is to UNIX what MinGW is to Windows. It amounts to a compatibility layer, and some of the Windows functionality does have to be simulated in some way, and that does amount to overhead. However, Linux is so much faster at various tasks, that the difference should in many cases be a wash, though WINE may be faster or slower depending on the activity in question. The main benefit, though, is the flexibility that Linux offers and being able to take advantage of it from Windows programs. I also just really like the idea of being able to play games without having to boot outside of my favorite operating system. My Linux installation is like a luxurious den with a La-Z-Boy and an attached workshop, so why would I want to leave to launch other applications?

So, WINE, as I said, is basically an impossible project. But that doesn't deter me from stubbornly attempting to run the latest games with it. And in actuality, the process of learning to work on WINE has felt sort of like building a ship in a bottle. My goal is to get some current FPS games running, and it takes a good bit of work.

No comments:

Post a Comment