← Back to context

Comment by skissane

2 days ago

If Microsoft wanted to invest more in Windows, I think the most useful thing would be to add more POSIX/Linux APIs and semantics to the Win32 API, to make it easier to port Linux software to being native Win32 apps… look at what Cygwin does, and identify the pain points (e.g. fork, exec without changing PID), and implement them in Win32 so Cygwin can be a thinner layer.. e.g. the NT kernel itself actually does have the moral equivalent of fork(), but Cygwin can’t use it because the Win32 subsystem (CSRSS.EXE) isn’t fork-aware, so instead Cygwin has to resort to highly complex and slow hacks instead… well, why not just make Win32 fork-safe? Of course, probably making every DLL and COM object fork-safe is way too much work (even on Linux, not all shared libraries are), but they could expose a way to “taint” a process as unforkable if any of those components get activated in it… maybe they could make Cygwin such a thin layer it becomes unnecessary, what if UCRT gave you equivalent functionality and all you had to do was ‘#define POSIX’?

I think that would be far more useful in practice than trying to close the gap between WSL1 and WSL2, which is what I’d interpret your “implement Linux” proposal as meaning

As far as trying to emulate Darwin goes, I think relatively few would be interested in running macOS apps on Windows, and I wonder whether there is a risk Apple might sue

I wonder if AI coding agents are going to improve to the point that they might radically change the incentives here - if adding new features becomes a lot cheaper, maybe the cost-benefit analysis will shift towards implementing more of this stuff

> trying to close the gap between WSL1 and WSL2, which is what I’d interpret your “implement Linux” proposal as meaning

My idea was to implement a true Windows subsystem for these alongside Win32.

  • WSL1 effectively is a true Windows subsystem.

    Okay, technically it is something new – a picoprocess provider – because classic Windows environment subsystems were too heavyweight.

    Trying to use the classical environment subsystem model (which POSIX and OS/2 used) for Linux wouldn't give you any clear advantage and would come with a significant performance cost. That's the whole reason why they added picoprocess providers to NT (originally intended to support Android emulation, later retargeted to generic Linux, the result of which was WSL1)

    • Can you elaborate on how exactly it differs from an old-school Subsystem?

      Can you have a process both calling syscalls from the Linux Subsystem and the Win32 Subsystem? Was that possible with the old-school Subsystems?