
The New Windows Subsystem for Linux (WSL2) Architecture [video] - bruxis
https://www.youtube.com/watch?v=lwhMThePdIo
======
billziss
Although many people seem to be receiving the WSL2 news well, I am one of the
few that feels that we will be missing something important with this new
direction.

WSL1 was pushing the boundaries of OS research: - a method for having multiple
syscall interfaces in a mainstream OS - processes in WSL1 were real NT
processes (even if lacking some of the NTOS environment) - direct integration
with the rest of the OS without an awkward VM separation layer.

In comparison WSL2 is basically an optimized VM with some fancy guest
additions. Color me underwhelmed.

I understand the argument that WSL2 is faster than WSL1 in file system
operations. I expect this will only be true for their root file system
("VolFs") and that performance will remain same or suffer for Windows drives
("DrvFs"). I am certain that they could fix "VolFs" performance by moving the
file system of NTFS and into a raw disk partition or VHD. (Note: I write file
systems both in and out of kernel.)

Finally WSL2 will be distributed with Windows which raises some licensing
questions (IANAL) if not in the letter of the GPL license at least in spirit.
I write GPL'ed software myself and I would be somewhat miffed if I saw my
software used in a similar manner (i.e. "via a VM", but still distributed with
non-GPL code).

~~~
mey
As described in the Video, they could not keep up with feature parity of
syscalls in Linux and some concepts are simply incompatible with the two
systems. They reference the concept of open file handles and moving folder
structures.

I think they found the boundary of OS research in this case, and a better
product is using the actual Linux kernel.

~~~
billziss
> They reference the concept of open file handles and moving folder
> structures.

I think this comment may have been disingenuous on their part. The reason is
that this problem more than likely still exists in WSL2 for the /mnt/c, /mnt/d
file systems (i.e. what they used to call "DrvFs" in WSL1).

WSL1 comes with (at least) 2 file systems. "VolFs" which is the file system
that they use for the Linux root file system and "DrvFs" which is the file
system that they use to access Windows drives (C:, D:, ...).

In WSL1 VolFs was implemented as a layer on top of NTFS, so it comes with all
the Windows file system and NTFS baggage. In WSL2 they will replace this file
system with a native ext4 formatted partition on a VHD file, thus eliminating
the Windows I/O stack (except for READ/WRITE I/O to the VHD file).

My contention is that they could have instead replaced VolFs with a native
WSL1 file system that uses a disk partition or VHD as its backend storage,
thus eliminating the Windows I/O stack in the same way. They could then have
implemented proper Linux file system semantics without any baggage.

> I think they found the boundary of OS research in this case

Unlikely. It would not surprise me if the changes we are seeing are less
technical and more political.

~~~
nikbackm
> My contention is that they could have instead replaced VolFs with a native
> WSL1 file system that uses a disk partition or VHD as its backend storage,
> thus eliminating the Windows I/O stack in the same way. They could then have
> implemented proper Linux file system semantics without any baggage.

But that would require them to implement a new file system from scratch
wouldn't it? VolFs in WSL1 relied on NTFS to do the heavy lifting.

Far easier to just let the Linux kernel handle it.

~~~
billziss
> But that would require them to implement a new file system from scratch
> wouldn't it? VolFs in WSL1 relied on NTFS to do the heavy lifting.

You are correct.

------
jchw
I was initially very excited for WSL2, but I do worry it will require Hyper-V
to be enabled. I use VMWare Workstation and it’s a true pain to switch Hyper-V
on and off. Also, I cant help but worry that this will somehow be a downgrade
in some way... will it be just as integrated? Windows Firewall worked on WSL
Pico processes for example.

~~~
skrebbel
if it needs hyper-v, then what's the point? how is it fundamentally different
from just running ubuntu in virtualbox with a shared network drive, then?
except where the terminal window is?

~~~
orf
The tight integration of course. And not having to use Virtualbox.

~~~
anon4242
Well, you won't be _able_ to use Virtualbox anymore.. at least for 64 bit OSes
:(

------
eatonphil
Switched to Windows from Linux on my work laptop 6 months ago. First-class
support for Zoom, Office, screen-sharing, presenting, etc. is good. General
terminal-based development is not fantastic, but WSL made it possible at all.
I can run all but my most Linux-specific programs (e.g. dependent on procfs).

Aside from not have some Linux pseudo-filesystems the bigger issue has been
the speed of file operations. I dread having to run `dep ensure` and `yarn
install`.

Why not just Hyper-V? Every few weeks I try to figure out how to set up a
static IP but I cannot for the life of me. So it takes 1-2 minutes every time
I want to reconnect because not only does it get a dynamic IP by default, it
is reset every day or so. Need to go into the VM via Hyper-V, get the current
IP address, reset /etc/hosts within WSL, reset /etc/hosts within Windows, SSH
into VM within WSL. It drives me nuts.

Really looking forward to WSL2 for faster file operations and being able to
run all my programs.

~~~
benou
Count me in.

Regarding the networking issue, I sort of solved it by using VMBus between my
VM and Windows. Shameless plug:
[https://github.com/bganne/hvnc](https://github.com/bganne/hvnc)

------
brianpgordon
Are there any plans to support graphical guest applications running in a
native Windows window, like VMWare Fusion? Their client/server VS Code demo
where only the UI runs in Windows seems really bizarre to me. Why not just run
X? I suppose you could pipe X over SSH but it would be nice to get built-in
support without the hassle or performance penalty.

~~~
Scarbutt
Their equivalent of vmware fusion is hyperv.

~~~
phishfi
Is it? I didn't think Hyper-V allowed separated windows. The only resource
I've found that does this effectively is X410.

------
Tepix
After using Linux on the desktop for around two decades, I'm forced to use
Windows 10 since a few months.

WSL is what makes it somewhat bearable. I look forward to Windows Terminal and
WSL2.

------
hs86
This seems to run on a VM that dynamically adjusts its RAM size according to
the current usage. Does a VM like this have any kind of file cache?

~~~
benou
This is already supported in HyperV VM, and the concept is old: it is called
ballooning.

Basically a driver in the Linux guest (hv_balloon for HyperV, but you have the
same things for KVM, VMWare etc.) can artificially "inflates" its memory use
when detecting too much unused memory and give it back to the host. When the
guest needs more memory, the balloon driver will give the memory back. Couple
with hotplug memory support and things can be pretty dynamic.

Not sure if they do something more sophisticated for WSL2 though.

------
1wd
I'm surprised, is integrating a Linux kernel with Windows not a GPL violation?
Is this a "mere aggregation" situation? Are the Linux kernel and other closed
source Windows code at no point linked, or exchanging complex internal data
structures?

~~~
jahewson
Given that it requires HyperV it’s running in a manner similar to a VM. That
doesn’t require linking and any I/O occurs via the normal channels (CPU
interrupts, serial console, etc).

This is similar to how running a userland application on Linux doesn’t require
the application to be GPL’d because it’s not directly linked to the kernel.
While it interacts with the kernel it is not _derived from_ it.

~~~
_wmd
This is fairly classic engineer thinking and what I was referring to in my
comment below.. you can wrap a GPL library in its own program, put that
program on a separate VM on a separate physical host in a separate physical
building, talk to it only over a network interface and your program's
resulting interaction with it might still be construed as linking.

Similarly, your program might statically link against a GPL'd library, but
only pass bulk data through a programming interface in a coarse manner, and
the result may not be considered linking. The FSF FAQ even explicitly
addresses this case.

GPL leaves these kinds of mechanisms blurry and ill-defined (I presume
intentionally), it's just that as engineers we are commonly only taught how
violations manifest in the usual case.

~~~
billziss
I think I agree with your overall understanding. It would be interesting to
learn what FSF's position is regarding WSL2.

------
jpeeler
I'd be interested to see a Microsoft backed Wayland implementation to support
GUI apps. Basically very similar to how Chrome OS has done it with Crostini.
If you're interested too vote here:

[https://wpdev.uservoice.com/forums/266908-command-prompt-
con...](https://wpdev.uservoice.com/forums/266908-command-prompt-console-
windows-subsystem-for-l/suggestions/16524991-wsl-wayland-display-manger-
support-may-be-easie)

------
arcboii92
That's all cool, but I just learned you can type an exe into Windows
Explorer's address bar to open it in the current directory. MIND BLOWN.

------
Narishma
Since it uses Hyper-V, does that mean it won't work anymore on the Home
editions of Windows 10?

~~~
arcboii92
Probably not. But you can get legit Win 10 Pro keys from ebay for like $5

~~~
Narishma
Yeah, I'd rather pay 0$ and use VirtualBox or VMWare instead.

------
yarg
I'd really like for this to support accelerated graphics - unfortunately I
imagine that would require a comprehensive solution to GPU virtualisation at
the DirectX level, which would at least need to be implemented in drivers - if
not also supported at the hardware level.

Without that, then the main reason that I'd even be using the subsystem - GPU
compute - is unavailable, and I'll need to actually boot into Linux if I want
to do anything useful.

------
monocasa
Sounds like Docker for Mac for Windows. Might have some of the same shared FS
consistency issues from running two full kernels with their own FS caching
hierarchies.

~~~
unilynx
Here's to hoping Docker for Windows will rebase on WSL2 and make the same jump
in quality as Docker for Mac did when they dropped virtualbox

------
pdonis
Why would I want to run a proprietary, closed-source implementation of what is
supposed to be an open source operating system?

~~~
WalterGR
You personally? Hard to say since we don’t know your needs.

But other people seem to have a reason, based on the comments here and in
every submission about WSL.

What are your needs?

------
xfer
This way ZOL also works on windows. Might make me switch to windows where i
occasionally play windows only games.

------
taf2
Why isn’t windows just built on Linux at this point are there reasons for MS
to maintain their own kernel? There must be people inside of MS asking this
just like how edge is now built on chromium...

------
packet_nerd
It'd be awesome if nmap and other network tools work in WSL2.

------
apotatopot
Just release Office for Linux and this wouldn't be necessary at all.

~~~
scardine
While all my servers are Linux, on the Desktop it is my last choice.
Interesting enough I used to love customizing the window manager to death but
I'm older now and I just want something that is consistent and works out of
the box.

Macs work really well out of the box but with some tweaks WSL makes Windows a
quite decent development workstation.

Currently I'm using Windows + WSL and I'm quite satisfied. Looks like with the
new version some of the tweaks to use docker are not necessary anymore. Great
work, Microsoft, keep the pace.

~~~
CoolGuySteve
I have the same motivation as you, I just want shit that works.

But Windows is the absolute last place I find that. All I get are updates that
break my setup, constant inane interruptions from Cortana or the desktop or
wherever, advertisement tiles in the fucking start menu, forced updates that
can't be done in the background, Windows Activation disappearing after
hardware upgrades, etc.

I feel like I'm in the Stepford Wives with all these people coming out of the
woodwork to proclaim how majestic the Windows experience is.

A few years back I switched from Mac to Ubuntu for the faster, cheaper,
diverse hardware and I have to say, it's pretty much perfect in the "Just
Works" department on the 3 laptops + 2 desktops I've installed it on. But I'm
also one of those people that actually liked Unity so I don't have to mess
with it much after installing.

~~~
scardine
Interesting, may be I have some setting that prevents Cortana from annoying me
and prevents windows from placing ads on the start menu. Not that I use the
start menu often, generally I just hit the search box and start typing the
name of the app I want (if it is not pinned to the task bar already).

I'm using Windows 10 Pro (Insider Preview fast track) and not seeing the
annoyances you are experiencing.

~~~
phishfi
In my experience, the ads are only present at initial setup. Once you remove
the shortcuts (and disable suggested apps), they don't show up again.

