6 ms·
WSL2 is a simple virtual machine. Nothing you couldn’t do on macOS with e.g. multipass.
by selsta 6y ago
WSL2 is a simple virtual machine. Nothing you couldn’t do on macOS with e.g. multipass.
- withinboredom 6y agoBut it’s not simple. It’s nothing like a “simple” VM.
- Sangeppato 6y agoIt's a headless VM that runs on Hyper-V
- AstralStorm 6y agoOnce Microsoft finishes the work on DXGI for Linux, it won't even have to be headless. It's also very paravirtualized, which is why HyperV enlightenments are required for WSL2 guest.
- withinboredom 6y agoThat's a gross over-generalization: https://www.techrepublic.com/article/wsl-2-where-is-it-and-where-is-it-going/#:~:text=The%20WSL%202%20hypervisor%20is,interactions%20between%20Windows%20and%20Linux https://www.techrepublic.com/article/wsl-2-where-is-it-and-w....
- Sangeppato 6y agoSure, it has some nice integrations, but I don't see how this article is in contradiction with what I've said. (To be clear, I didn't mean it as a critique, I like Hyper-V)
- mtzet 6y agoNot really. Under HyperV both the Windows and Linux kernel run subsidiary to the HyperV hypervisor, so in that sense Windows itself is "just a virtual machine". The work in TFA describes patches to make the Linux kernel communicate with the hypervisor (sharing information like used memory pages). In my book that's pretty sophisticated. EDIT: The work appears to be available on Github https://github.com/microsoft/WSL2-Linux-Kernel/commits/linux-msft-wsl-5.4.y https://github.com/microsoft/WSL2-Linux-Kernel/commits/linux...
- AshamedCaptain 6y agoIt doesn't matter how the hypervisor is arranged, but it is still just a virtual machine. Just because it happens to run on a type1 vs type2 hypervisor means not much, or just go ask around whether Xen is any faster than KVM these days.
- danieldk 6y agoBut the filesystem integration is much better than a VM in macOS, being able to run Window programs from Linux, etc. Also, Windows has decent X11 servers that work well with retina displays, which can't be said of XQuartz.
- AshamedCaptain 6y ago"Windows programs for Linux"? It doesn't really have any better filesystem integration. The filesystem is stored on a disk image on WSL2 as on any other VM. You can mount other host filesystems from inside the VM in any hypervisor I know of. Ack on XQuartz being crap (thought it does have Retina support these days, at least for non-rootless mode), but this is not really a problem of the VM.
- danieldk 6y ago"Windows programs for Linux"? Whoops, typo. Windows programs from Linux, I'll fix that. You can mount other host filesystems from inside the VM in any hypervisor I know of. In most hypervisors you can't do a notepad.exe foo.txt or TextEdit.app foo.txt for that matter in a Linux VM,
- microcolonel 6y agoWith virtio-fs I think this is becoming more doable. Of course, it's not quite as fast as running a guest filesystem on virtio-blk yet, but maybe it'll get there.
- tilolebo 6y agoWSL2 is a simple VM like Docker is a simple Linux container.
- Diggsey 6y agoIt's really not. With WSL2 the kernel runs in a VM, but user-space programs do not. As a result, CPU-bound programs suffer close to zero overhead compared to running natively on linux. AFAIK, there's no way to achieve anything like this on macOS.
- Sangeppato 6y agoDo you have any source/documentation for this? I'd really like to read more about it, my understanding has always been that WSL2 was more or less a classic VM on a type-1 hypervisor (Hyper-V)
- crumbshot 6y agoThat is not quite correct, it is in WSL1 that they are NT processes, with Linux syscall emulation. But in WSL2 the whole thing runs in a Hyper-V VM, with a customised Linux kernel (available via http://linux.microsoft.com http://linux.microsoft.com) to help with interoperability between WSL and Windows.
- qalmakka 6y agoYou got it completely wrong. WSL1 was a system call translation layer, and everything worked directly on the Windows kernel, like Windows programs do under WINE. WSL2 is an standard Hyper-V virtual machine, no more no less, with a custom Linux kernel build and a ext4 root filesystem stored in a .vhdx image. Every process runs as a native Linux process under the Microsoft's Linux kernel, _inside_ the VM. What makes it more convenient than simply opening the Hyper-V manager and creating a VM is ease of installation, maintenance and integration with Windows (using the 9p protocol to allow file access).
- withinboredom 6y agoAnd you got it all wrong :p. It’s not a “standard Hyper-V virtual machine” you can’t make one from scratch.
- qalmakka 6y ago