4

I did find a lot of information about how the Windows Subsystem for Linux (WSL) works on the msdn Blog. I know it's based upon translating the Linux syscalls to NT syscalls in real time and therefore it's possible to run unmodified ELF binaries.

WSL is a NT subsystem, and so are/were the Microsoft POSIX subsystem, the Windows Services for UNIX (SFU), and the Subsystem for Unix-based Applications (SUA) / Interix.

Cygwin on the other hand is an application that sits on top of the Win32 subsystem.

On the blog it says that programs needed to be recompiled for SUA. Since SUA is (how I understand it) the successor of SFU which in turn is the successor of the POSIX subsystem. So I assume all those needed recompiled binaries, too.

If that's the case then how do those predecessors of WSL differ from Cygwin?

I'm looking for a comparison between the previously mentioned systems/programs and how they work 'under the hood'. (Specifically how WSL differs from its successors)

PS: needed to remove some links for now since my reputation on SU limits me to 2

2

Interix/SFU/SUA is a lightweight subsystem, replacing only the userspace Win32 layer with something like a Unix libc – even though there is a "subsystem driver" (psxss) for certain tasks, it still uses Windows PE (.exe) executables, the libc still uses NT kernel syscalls, Interix processes look almost entirely like Win32 or native processes, and they have the same filesystem access.

Cygwin is similar but simpler; it's built entirely as a userspace runtime library on top of Win32 (with the occassional NT call). As a result, Cygwin apps are really just Win32 apps which use a really weird libc.

In comparison, WSL is much more extensive than even SUA – the Lxss driver reimplements Linux kernel syscalls rather than userspace library functions, and can run unmodified ELF binaries (the default WSL system is stock Ubuntu). The WSL environment is mostly self-contained and is practically a "User-mode Linux" virtual machine, with very little interaction with the host OS. Although WSL processes show up in the shared process tree, you can't just run /bin/sh directly – you have to boot the entire WSL system, which is done by bash.exe behind the scenes. (There was a blog post about that.)

  • Most important distinction between them is the fact WSL can run the same tools Ubuntu runs from the same repository. The only exception (at this time) is those tools with a user interface. – Ramhound May 15 '17 at 12:45
  • It is not a weird libc. Newlib is just different from GNU libc as it is mainly derived from BSD – matzeri May 15 '17 at 15:01
  • What the mentioned blog post this one? blogs.msdn.microsoft.com/wsl/2016/10/19/… – Stijn Sanders Sep 12 '17 at 8:06
3

Regarding SUA/SFU and Interix, there's a difference. Wikipedia explains it pretty well and extensive: Microsoft POSIX subsystem and Interix

Interix was a BSD implementation on top of the POSIX subsystem. You could replace it with another implementation like a GNU Debian or NetBSD (which was done). SUA (2005) opened up the POSIX subsystem so you could extend it with NT calls and even run mixed Posix/Win32 applications.

Unfortunately Microsoft never released suitable development tools and even outsourced the support. There were a forum where users could help each other out with development and other things. The support company supplied a repository with a wide range of binary packages. Eventually Microsoft stopped funding and pretty much all info about Interix disappeared when the support company closed down the forum.

In short: The SUA Posix applications were very fast, probably the most efficient you could run on Windows. But they were a pain to develop, involving hacking into NT and Posix system files, ie a lot of fun.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.