4 ms·
> I really doubt that WSL2 will be at native speed with the Linux file system, because reads and writes still have to go through Windows kernel to be mapped int
by sz4kerto 4y ago
> I really doubt that WSL2 will be at native speed with the Linux file system, because reads and writes still have to go through Windows kernel to be mapped into actual hardware reads/writes.
No, Linux is running alongside Windows, not under it. Windows itself is virtualized when WSL2 is turned on, and both Linux and Windows run under Hyper-V. It's quite fancy actually.
- madeofpalk 4y ago> Windows itself is virtualized when WSL2 is turned on Is there documentation/explainer for this? I've been trying to understand more about this (was this a change in Windows 11? Is it only when WSL2 is installed?) for a while now, but not found anything apart from stray HN comments every now and then.
- wongarsu 4y agoIt's the fundamental difference between WSL1 and WSL2. As designed in the 90s, the Windows NT kernel can have different subsystems that offer different userspace APIs to different software. Originally there were the Win32 subsystem, the Security subsystem, the Posix subsystem and the OS/2 subsystem. The latter two fizzled out, but WLS1 is basically just another subsystem that provides a linux-compatible API to the Windows kernel. As it turns out providing full compatability is really hard though, so WSL2 is a complete rewrite, ignoring the subsystem concept. It basically just runs linux in Hyper-V, and adds some UI/UX to make that convinient. That Windows is then running virtualized is just how Hyper-V works, as soon as you turn on Hyper-V the host Windows runs as a guest in Hyper-V, though with special privileges [1] https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/about/#limitations https://learn.microsoft.com/en-us/virtualization/hyper-v-on-...
- joshuaissac 4y ago> WLS1 is basically just another subsystem that provides a linux-compatible API to the Windows kernel WSL1 is not an NT subsystem, either. WSU (the POSIX subsystem) was an actual NT subsystem, but with WSL, they abandoned this concept and went with a different design for performance reasons. https://news.ycombinator.com/item?id=25249262 https://news.ycombinator.com/item?id=25249262
- thesz 4y agohttps://github.com/microsoft/WSL/issues/2395 https://github.com/microsoft/WSL/issues/2395 This is still a problem with WSL2, at least on my WSL2 with Windows file system mappings. I tried to use instructions that use fossil from the hctree page: https://sqlite.org/hctree/doc/hctree/doc/hctree/index.html https://sqlite.org/hctree/doc/hctree/doc/hctree/index.html Fossil employs sqlite to store SCM information and it fails with "SQLITE_IOERR(1290): os_unix.c:39533: (22) fsync(...)" error, which is the same with VirtualBox: https://www.fossil-scm.org/forum/forumpost/7fb6c96d80?t=c https://www.fossil-scm.org/forum/forumpost/7fb6c96d80?t=c So WSL2, having to put up with Windows quirks, is not much a Linux anymore. It is slow and some programs can't even run.
- csdvrx 4y agoA valid critic given that there's no native filesystem support yet. But if WSL2 is given its own drive to mount and do what it wants with it, the issue should disappear. And when WSL2 supports passing partitions, the issue will vanish.
- shawnz 4y agoWSL2 is powered by Hyper-V, which is a "type 1 hypervisor": https://en.m.wikipedia.org/wiki/Hypervisor#Classification https://en.m.wikipedia.org/wiki/Hypervisor#Classification https://learn.microsoft.com/en-us/windows-server/administration/performance-tuning/role/hyper-v-server/architecture https://learn.microsoft.com/en-us/windows-server/administrat...
- jmmv 4y agoI wrote something on this topic a while ago: https://jmmv.dev/2020/11/wsl-lost-potential.html https://jmmv.dev/2020/11/wsl-lost-potential.html
- shawnz 4y agoNote that WSL 1 doesn't use the NT subsystem functionality. See this sibling comment for details https://news.ycombinator.com/item?id=34640434 https://news.ycombinator.com/item?id=34640434