5 ms·
Question -- from what I understand, WSL2 is closer to Linux running in a VM, whereas WSL1 was like a Windows kernel level version of Cygwin. Is that mostly cor
by derekp7 7y ago
Question -- from what I understand, WSL2 is closer to Linux running in a VM, whereas WSL1 was like a Windows kernel level version of Cygwin. Is that mostly correct?
Regarding that, remember a number of years ago, prior to VMs there was a patch set for the Linux kernel porting it to user space -- so you could run Linux as a user process, which ended up functioning similar to running it in a VM. Would WSL2 be closer to this model, or is it really running Linux under a stripped down Hyper V?
- minxomat 7y agoWSL 1 was closer to flinux than cygwin.
- derekp7 7y agoAh, I completely forgot about flinux. Seems there were a lot of neat innovations back in the earlier days, including a couple of single system images (SSI) implementations (the opposite of VMs, making a network of hosts look like a single multiple processor system).
- freeone3000 7y agoLiterally running Linux under regular hyper-v, with some clever FS tricks.
- veesahni 7y agoCorrect. WSL1 ran ELF binaries on Windows (as crazy as it sounds). WSL2 is basically linux in a VM + OS provided helper services on both sides.
- yjftsjthsd-h 7y ago> Question -- from what I understand, WSL2 is closer to Linux running in a VM, whereas WSL1 was like a Windows kernel level version of Cygwin. Is that mostly correct? Yes, that's essentially correct. You could also think of it as WINE in reverse; one big difference from cygwin is that it runs unmodified binaries rather than needing to recompile. > prior to VMs there was a patch set for the Linux kernel porting it to user space -- so you could run Linux as a user process User Mode Linux (UML; https://en.wikipedia.org/wiki/User-mode_Linux https://en.wikipedia.org/wiki/User-mode_Linux), which I think is still a thing, although not super popular. > Would WSL2 be closer to this model, or is it really running Linux under a stripped down Hyper V? Not even stripped down; it's running Hyper V. (This is one of the big problems with WSL2; if you use it, you can't use non-HyperV virtualization.)
- monocasa 7y ago> which I think is still a thing, although not super popular. Yeah, I compiled a version last week. It's occasionally nice for kernel devs to have an env to try out new ideas, so it more or less gets maintained. Google's gvisor project is sort of a blend of that and WSL. A reimplementation of the linux syscall layer like WSL, but as a linux process like UML instead of as a kernel module as in WSL.
- cpach 7y agoDid WSL1 not use the same binaries as a regular distro? IIRC it will download regular x86-64 .deb packages straight from e.g. Ubuntu’s APT repositories.
- bitwize 7y agoWSL (1) was what the BSD people call a "kernel personality", which allows one kernel to emulate another at the syscall and ABI level.
- robocat 7y agoSo WSL1 on Windows is similar to Wine on Linux?
- saagarjha 7y agoRight.
- danieldk 7y agoThere is a big difference in that WSL1 only needed to implement Linux syscalls, they could use glibc and all other libraries from the Linux distribution that you are running, whereas Wine needs to reimplement all Windows APIs to work with most applications. Also, Wine is really a program on top of Linux, while personalities are a core feature Windows. At a low level, the Windows kernel is agnostic wrt. the system ABI. Win32 is just one personality of the Windows kernel, just as NT used to have an OS/2 personality to run 16-bit OS/2 programs.
- cturner 7y agoDanielK posted good points already, this is another perspective. WSL1 shows off a character of the Windows kernel, Environment Subsystems: https://en.wikipedia.org/wiki/File:Windows_2000_architecture.svg https://en.wikipedia.org/wiki/File:Windows_2000_architecture... (top right) When you boot into Windows 10 normally, you are interacting with applications run by one of these subsystems. WSL1 is now another of these subsystem. Like wine, you are getting an API that looks just like Linux. But, unlike wine, that Linux is a first-class citizen as far as the OS is concerned. It would be straightforward for the Windows devs to connect the Linux subsystem across to the Windows security module (see diagram). There is no analogy for that with Wine on Linux.
- bitwize 7y agoNo, because Wine doesn't emulate NT system calls. It is a Win32 API compatibility layer.
- mehrdadn 7y ago> Windows kernel level version of Cygwin Kind of. But from a userland perspective, Cygwin is a (very slow and complicated) layer between the application and the kernel, whereas WSL1 really is (and importantly, feels) like just another API for the exact same kernel. That's kind of its entire advantage over Cygwin, so I wouldn't really compare them like that.