This blog is subject the DISCLAIMER below.

Monday, September 29, 2008

Wine -- Windows Applications On Linux

Wine is a program that runs MS Windows applications on Unix-based systems by providing a compatibility layer by implementing some of the Windows APIs and wrapping the others to call native Unix functions, X server, and OpenGL. Wine implementation is all in userland (outside the kernel and doesn't need special privileges)[1].

Wine was originally short of WINdows Emulator, but I a am not sure about if that's still the case. "Wine" is originally a recursive acronym "Wine Is Not an Emulator"[A]. (Update) Wine is more of a compatibility layer than of an emulator. An emulator usually emulates hardware, like a Playstation emulator (offtopic: I know a good one called pSX).

Wine doesn't only implement Windows system calls, but also most of the DLLs that comes with
Windows. Most notably DirectX (which is one of the top reasons to use Wine; playing Windows games on Linux). If you are a windows license owner you can use some of the native Windows DLLs instead (but others can't be used).

ReactOS[8] is to Windows as Linux is to Unix. A free and open source alternative. It uses Wine code. Several other commercial projects uses Wine too, like TransGaming Cedega and CodeWeavers CrossOver (and others). The former is a fork of Wine specially for gaming, they do NOT send their patches to the main-stream Wine. The latter is both a general-purpose and gaming-purpose dedicated development for Wine. Unlike the former, the latter sends it patches instantly to the main-stream Wine. It relies mostly on support for profit (as for what I understood).

Google have paid CodeWeavers to make Wine able to run Photoshop CS 2 on Linux[2]. CodeWeavers also have acted quickly to to make Wine able to run Google Chrome on Linux, and they made it in 11 days[3]. Google has actively encouraged Wine development through their interns [4] and through student participation during the Summer Of Code 2008 [5].

The only Microsoft acknowledgment about Wine, is to state it is not Genuine Windows and therefore deprived from Windows Genuine Advantage (some downloads). [6] Generously, Microsoft still allows some updates, like Office updates to Wine users. [same source]. (See [7] for instructions how to install Office 2003 on Linux.)

Wine is not small at all. WINE 1.0 have over 1.8 million lines of C code (with blank lines and comments), ~300,000 of which are tests, and ~87000 are related to Direct3D (a subset of DirectX) implementation[original research]. I am not sure how big is the Micorsoft Subsystem for Unix-based Applications (SUA)[9](*1), but I am sure it is much less. That's because what a Unix program assumes to find in a system is much less that what a Windows application assumes to find (which are thousands of Windows APIs[10]).

(Update)
Due to the large amount Wine has to implement, it doesn't implement all of the Windows APIs yet. A program that depends on an unimplemented API might not function correctly. Wine developers try to implement high-priority APIs first. Those are the ones used by the most popular applications. (For a list of which programs are compatible with Wine check Wine AppDB[11])

(Update)
Wine have been in development for more than 16 years (since 1992); even before Linux was born[12]. Wine's still not complete, because it faces the problem with catching up with more recent Windows systems. For example (not saying that this have actually happened), when they completely supported Windows 95 applications, they were struck by XP, and then XP SP 1 and Windows 2000 (just an example, I know there are several editions in the middle). Wine development is indeed much slower than the real development pace of the real Windows (thousands of organized developers vs. hundreds of random contributers - ~700 have contributed to Wine somehow [12]).

(*1)
Wine is binary compatibility layer, which means the binary executable can be executed both on Windows and Linux without modifications. While MS SUA is source compatibility layer, which means the same program will have two executables, compiled differently, but from the same source, in order to run on both platforms.

Wine's web page: http://winehq.org/ .

Other references and links:

[1] Linux Unified Kernel is a project to implement Windows system calls (only, not the entire set of APIs) natively in Linux kernel.
[2] http://apcmag.com/google_behind_photoshops_new_linux_compatibility.htm
[3] http://www.heise-online.co.uk/news/CodeWeavers-bring-Chrome-to-Mac-and-Linux--/111535
[4] http://code.google.com/opensource/wine.html
[5] http://wiki.winehq.org/SummerOfCode
[6] http://www.microsoft.com/genuine/downloads/faq.aspx
[7] http://www.wine-reviews.net/microsoft/running-ms-office-2003-under-linux-with-wine-0952.html
[8] http://www.reactos.org/en/index.html
[9] http://mohnabil.blogspot.com/2008/09/microsoft-subsystem-for-unix-based.html
[10] Unlike Windows system calls (http://www.metasploit.com/users/opcode/syscalls.html), which are less than 400 in Windows Vista, the entire set of the windows APIs are much more (http://www.codase.com/windows.html)
[11] http://appdb.winehq.org/
[12] http://www.winehq.org/site/history
[A] http://wiki.winehq.org/FAQ?action=recall&rev=217#head-8b4fbbe473bd0d51d936bcf298f5b7f0e8d25f2e

No comments: