6 ms·
The problem with each of these tools (Lima etc.) is that it’s still fundamentally a virtual machine under the covers. The great thing for me about WSL (and why
by highwaylights 4y ago
The problem with each of these tools (Lima etc.) is that it’s still fundamentally a virtual machine under the covers.
The great thing for me about WSL (and why IMHO it was worth all the effort they put into it), is that because the kernel process tree is running as a native Windows process tree, I don’t have to pre-allocate memory ahead of time.
This is murder on Apple’s RAM-restricted laptops, and kind of rubbish on machines with massive RAM too. Most of the time, most of your memory goes unused. The base model Airs/Pros for example need to have 25-50% of your RAM locked away just to run a Linux container at all - when you already have a fairly anaemic 8GB to begin with that’s pretty dire.
- augustl 4y agoIt's a shame they essentially deprecated WSL1 and is doing everything in WSL2 now, where exactly this kind of memory allocation and the performance issues that entails is an issue. Not that I think it's a bad decision, but I wish they somehow managed to break Conway's Law and enhance Windows itself by fixing the file system speed issues as well as somehow making NT/Windows processes fork instantaneously just like on Linux :)
- baq 4y agoTheir explanation was that Windows could not be enhanced but rather should be slimmed down - the APIs that the NT kernel provides can't be efficiently worked around without breaking all kinds of already existing Windows software.
- jstarks 4y agoWe work very closely across the file system, kernel, and virtualization teams, so I don’t think we can blame Conway’s Law for WSL2. And actually our WSL1 fork performance wasn’t too bad IIRC—we have real fork at the Windows kernel level, it’s just not something that can realistically work with the Win32 programming model. I also think we will eventually resolve the file system performance issues. No, the most important reason to choose a VM instead of a reimplementation of the Linux ABI is long tail compatibility. You can’t realistically replicate and then keep up with every corner of the Linux kernel’s interface. And so with WSL1, software will randomly not work, or it will randomly break after an apt upgrade, and users will get frustrated and switch to a VM anyway. Might as well get perfect compatibility and still have nice integration with Windows via the WSL2 approach.
- augustl 4y agoThanks for the detailed explanation! You folks have actually tried to implement an ABI compatible Linux kernel, so I'll definitely take your word for it :)
- Tsarbomb 4y agoI think most people understand why the WSL2 approach eventually won out, and its saved my bacon more times than I can count when I had to demo something and it breaks on my Mac only for me to quickly switch to "real" linux on my personal windows machine running WSL2. However, with WSL1, implementing the Linux ABI was such a wicked flex.
- NelsonMinar 4y agoSeconding that. WSL1 is an impressive achievement. I use WSL every day and switched to WSL2 a long while back but I still kinda wish WSL1 were the way forward.
- yjftsjthsd-h 4y ago> when I had to demo something and it breaks on my Mac only for me to quickly switch to "real" linux on my personal windows machine running WSL2. How's that any different than running a virtual machine on your Mac with a real Linux in it?
- Tsarbomb 4y agoSeamless mounting, launching code editors in Windows from Linux, issuing docker commands in the Linux OS while the docker engine and its mounts are hosted on Windows. Doing things with something like Vagrant on Mac sometimes cuts it, sometimes doesn't. Either way, if I'm not shelling out money I could be stuck using a subpar solution like VirtualBox.
- userbinator 4y agoYou can’t realistically replicate and then keep up with every corner of the Linux kernel’s interface Didn't Linus famously say they'll "never break userspace"?
- donatj 4y agoThe other commenter alluded to this but didn’t say it outright: WSL2 is essentially just a special VM with API based limited hardware access. It’s neat though, the file systems are connected over 9p.
- baq 4y agoIt is - but its speciality is exactly what matters most - it doesn't preallocate RAM and in fact can dynamically release it back to the host without any user intervention. It's super convenient.
- easton 4y agoTo this day I wish they'd release decent (i.e. well documented) APIs for creating VMs like this yourself with Hyper-V. I sometimes have to spin a bunch of Windows VMs for testing, and if they could dynamically release RAM and CPU when they aren't using it it would be amazing. They have something like it with Windows Sandbox but you can only spin one at a time.
- fassssst 4y agoThere are PowerShell functions for creating VM’s.
- sebazzz 4y agoThat's not what OP meant. OP meant interfacing with Hyper-V from inside the VM. Things like dynamic memory allocation and release aren't some kind of black magic, but are something that is actually directly communicated by the guest VM.
- GordonS 4y agoHyper-V does support memory ballooning (dynamic memory allocation from host to VM) - is that what you mean, or do I misunderstand? This does need support in the guest VM, but I've only ever had issues with really old Linux distros.
- killingtime74 4y agoYou are right and it can definitely be improved, however at all my jobs I’ve had 32-64gb MacBooks, is that not true for most developers? When I didn’t i was able to buy an actual Linux laptop
- duxup 4y agoDepends on the company and developer I suppose. Web dev here, ran with 16 up until recently… now at a whopping 24… No memory pressure.
- pjmlp 4y agoNope, most contractors get issued a laptop with 8GB unless their project is doing anything container related, in which case they get a 16GB one. Assuming that they just don't get a cloud VM accessed via Citrix/RDP.
- zxspectrum1982 4y agoThe great thing for me about WSL (and why IMHO it was worth all the effort they put into it), is that because the kernel process tree is running as a native Windows process tree, I don’t have to pre-allocate memory ahead of time. CoLinux did that years before WSL1 did. Sadly, the project is dead and AFAIK it never really worked on Windows 64-bit, only on 32-bit: https://en.wikipedia.org/wiki/Cooperative_Linux https://en.wikipedia.org/wiki/Cooperative_Linux