3 ms·
Yes, it's "just" a VM. WSL2 is a bit like Firecracker for Linux. It's a lightweight VM, with a lot of optimizations here and there. For faster startup, lower m
by andix 11mo ago
Yes, it's "just" a VM.
WSL2 is a bit like Firecracker for Linux. It's a lightweight VM, with a lot of optimizations here and there. For faster startup, lower memory footprint and so on.
PS: which means you need a lot of memory, if you use WSL2 extensively (multiple Docker containers for example). 8-16 GB on top of your usual workloads is a good starting point. Docker on WSL2 is not a lot of fun with less than 20 GB system memory.
- nu11ptr 11mo ago> For faster startup, lower memory footprint and so on Any idea how they do this? My WSL2 starts insanely fast, like about 1-2 seconds. I've never seen a linux distro natively boot that fast. Assuming they suppress any sort of BIOS startup screen for starters, but what else?
- andix 11mo agoActually I don't know it either. But WSL2 doesn't really start a lot of processes, like a desktop/server Linux distribution. It starts up only a minimal set of processes, and a shell. dmesg looks like the kernel is booting up normally, so I guess they don't use some memory snapshots magic. I guess they just tweaked the kernel and the hypervisor to start up fast. There is also no BIOS/UEFI delay.
- sedatk 11mo agoIt’s a very trimmed down kernel with minimal set of drivers and modules. It doesn’t even support SD cards out of the box. That’s probably the main reason as no hardware probing/initialization delays are incurred.
- em500 11mo agoAt high level, WSL2 provides a single optimized VM and Microsoft-compiled Linux kernel. Optimized here means that the VM only provides a small set of devices to the Linux kernel, and the kernel operates with exact known hardware, which is much smaller and simpler compared to a full blown kernel (which detects a large variety of hardware) and fuller featured VMs (c.f. qemu emulated devices: https://kashyapc.fedorapeople.org/virt/qemu/qemu-list-of-emulated-devices.txt https://kashyapc.fedorapeople.org/virt/qemu/qemu-list-of-emu...). And when you run multiple "distributions" or instances, they all share the same running VM and kernel. So after a one-time startup of the VM+kernel, opening more distributions/instances is like starting new system containers (similar to lxc/lxd or systemd-nspawn, which are also very quick to spawn on Linux) rather than new VMs. The architecture is quite similar to Linux-on-ChromeOS (Crostini).
- pjmlp 11mo agoThankfully getting laptops with 32 GB on PC land isn't the same as paying Apple premium.
- andix 11mo agoI guess you didn't check the latest memory prices. 64 GB used to be dirt cheap, but not anymore.
- pjmlp 11mo agoWell thankfully I don't buy hardware every year, my laptop is from 2021. Also the difference to Apple tax in SSDs and RAM remains, or do you think Apple will let go of their beloved margins on top?
- antonkochubey 11mo agoif you're buying 'gaming' laptops - sure, but in business laptop world, Lenovo/Dell/HP premiums on RAM and SSD can be much higher than Apple's.
- torginus 11mo agoI've just put a stick of memory into my company thinkpad.
- andix 11mo agoBeen there. Back then memory was so cheap, that I didn't even bother of taking it out when i had to return it.
- pjmlp 11mo agoAs Thinkpad owner since 2005 of multiple models, that hasn't been the case so far. Contrary to Apple, we can still add RAM and SSDs in many models, and chose which brands we buy.
- robotnikman 11mo ago