Comment by zanecodes
2 months ago
Docker on macOS also runs a Linux VM under the hood, just like WSL2 does, they're no different in that respect. WSL1 used the more exotic approach of translating Linux system calls to and from NT kernel system calls, but for various reasons (compatibility, performance, complexity) Microsoft abandoned that technique and adopted a Linux VM running under the Hyper-V hypervisor for WSL2.
There is a difference in Hyper-V itself. The Windows hypervisor is underappreciated as one of the better VM hypervisors in some scenarios, and WSL2 uses a few Hyper-V tricks [0] to really shine if your machine's Hyper-V isn't interfered with by other hypervisors. (Sadly not uncommon given how many us have things like old VirtualBox VMs that still need Hyper-V to run in a compatibility mode with Oracle-maintained hypervisors of the past.)
(Also, WSL1 isn't as actively maintained as it was when WSA [Windows Subsystem for Android] was an active Windows 11 feature driving it, but it hasn't been entirely abandoned either and there is some community support ongoing [open source PRs].)
[0] Among other things, Windows likes to run itself at all times as a guest in Hyper-V when Hyper-V is active (and other ancient hypervisors aren't interfering), making Hyper-V VMs like WSL2 "peers" with Windows itself for Hyper-V resources/attention. (It's one of the funnier things about Hyper-V being a "Pro" feature still today because even consumer-focused Windows Home is often still running in Hyper-V [because it's also sometimes a defense-in-depth security/sandboxing in some consumer use cases], it just won't let you configure other VMs in it than your main Windows OS.)
I agree, Hyper-V is a pretty cool technology! I wasn't aware WSL1 was still supported at all, let alone receiving pull requests. Windows Subsystem for Android was a neat feature, but not something I used regularly, especially since it lacked Google Play Services which made many popular apps fail to function on it.
Yeah, it is often mentioned that WSL1/WSL2 are bad names when 2 isn't a direct successor as much as a peer that works well side-by-side. Something like WSLA and WSLB might been useful to help it feel less abandoned. The number of scenarios where WSL1 is better than WSL2 are fewer and weirder, so it will always feel "second ran", but Microsoft still seems to want to support it for the few weird use cases that are left (just not huge new ones that would need massive rewrites or compatibility lab teams to run more massive suites of Linux applications).
Also, yeah the lack of Google Play Services sure was a big issue with WSA, no matter how much Amazon want people to believe their replacements for Google Play Services are fine enough for most users/apps. Google Play Services is quite a moat today.