Hacker News new | ask | show | jobs
by ProofByAccident 2044 days ago
I'm extremely ignorant about OS design, but based on this it sounds like WSL1 could be fairly described as basically Linux for the Windows kernel, whereas WSL2 is more like a really fancy VM. Is that the gist of it?
3 comments

More or less. Though I'd rephrase your description of WSL1 as "Linux for the NT kernel".

In that sense "Win32" (the API used by Windows programs) could also be described as "Win32 for the NT kernel". They are both subsystems that translate their APIs into NT kernel calls.

Windows NT used to have a number of these subsystems but all except Win32 were deprecated and eventually removed.

I see, that makes sense! This is a really interesting design and seeing it this way gives me more respect for the Windows operating system generally. Is this subsystem concept something that has a parallel on the *nix/BSD side of the fence? Or is it unique to the NT architecture?
The closest example outside Windows I can think of is the idea of "zones" in Solaris/Illumos/SmartOS. You can have a "LX branded zone" where the OS will respond to linux syscalls.

I don't know if the native solaris syscall interface is itself a zone, while Win32 is a subsystem on Windows.

This is a cool example, and now that you mention it docker as well seems to provide similar functionality. I guess what's striking about WSL1 then (and maybe what the author was saying) is that it's a mix between a docker container and like wine.
It is also how IBM mainframes work.
WSL1 is like the "kernel personalities" in other operating systems like the BSDs. WSL2 is more like Linux for Windows, because it is the actual Linux kernel in a VM, hypervised by Windows.
Kind of, Hyper-V is a type 1 VM, so Windows is also a guest OS.
Without making a value judgement, that is pretty much spot on
Sweet, thanks!