Slash Boxes

SoylentNews is people

SoylentNews is powered by your submissions, so send in your scoop. Only 18 submissions in the queue.
posted by martyb on Sunday March 15 2020, @03:28AM   Printer-friendly
from the EEE? dept.

Microsoft's Windows Subsystem for Linux is coming to all Windows 10 users (archive):

You won't have to be a tester to try Windows 10's new, built-in Linux kernel in the near future. Microsoft has confirmed that Windows Subsystem for Linux 2 will be widely available when Windows 10 version 2004 arrives. You'll have to install it manually for a "few months" until an update adds automatic installs and updates, but that's a small price to pay if you want Linux and Windows to coexist in peace and harmony. It'll be easier to set up, at least -- the kernel will now be delivered through Windows Update instead of forcing you to install an entire Windows image.

Embrace, Extend... Excite!

Windows blog post.

Previously: Windows 10 Will Soon Ship with a Full, Open Source, GPLed Linux Kernel

Original Submission

This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 5, Informative) by TheRaven on Sunday March 15 2020, @05:00PM (2 children)

    by TheRaven (270) on Sunday March 15 2020, @05:00PM (#971613) Journal

    There are three things to compare here:

    Cygwin is a Windows DLL that provides a more-or-less complete set of POSIX APIs, with some Linux-compatibility things. It also provides a package manager and a few other things, but it's basically a way of compiling a *NIX program so that it will run on Windows. Because Cygwin programs are native Windows programs, they can load Windows DLLs, including the ones required for talking to the windowing system, and interop natively.

    WSL was a compat layer akin to the Linux system call layer found in *BSD, Solaris, and so on. It is a bit more complex on Windows because Windows doesn't have quite such a strictly defined kernel interface. For Win32 (and UWP) apps, there are a lot of DLLs that are injected automatically, where some kernel component can directly manipulate the kernel-owned data structures within the process. WSL uses the picoprocess abstraction defined for Drawbridge (the Windows-based library OS). A picoprocess is even more cut down than a *NIX process: it's basically like a Mach task, with nothing inside and just a control handle. Current Windows kernels only provide one picoprocess handler (though it wouldn't be very difficult to fix this). This is used by WSL, so when a picoprocess is created it is then initialised to look like a Linux process on start up and has a Linux-compatible system call handler installed. As a side effect of WSL, Windows got a full pseudoterminal layer and some other reusable components. WSL processes are not normal Windows processes, but the layering is such that they sit on top of the same low-level services as Windows processes (unlike the old POSIX and OS/2 subsystems in Windows NT, which had completely different implementations for things that you'd quite like to be shared, such as most IPC). In particular, the filesystem is shared. This is the main performance pain point for WSL: there's a filter driver that sits on top of the NTFS driver and provides NT or POSIX semantics to the filesystem depending on how it's being accessed.

    WSL2 is much simpler. It's a Hyper-V VM set up to use the WSL terminal layer as its system console (I believe that this is done by forwarding the serial interface through the Windows pseudoconsole, but I'm not sure, it my just be using SSH), with a root filesystem that's attached as a block device containing a Linux-native filesystem (so no translation via filter drivers), and with shared folders implemented as 9P over VMBus (hopefully FUSE over VMBus soon, but I don't know if that's actually on the Hyper-V team's roadmap). This has a native Linux kernel, so has a full network stack, IPC layer, and so on. This can communicate with the host kernel only via network IPC. In theory, that's a big limitation, but in practice that's pretty much all WSL1 programs ever do.

    On the X11 side, there are several builds of for Windows. I believe VcXsrv [] is the best choice. There are also a load of expensive alternatives, though I've not seen any evidence that they're better. These all (as with any X server) communicate with network-transparent IPC, and so work fine with Cygwin applications, WSL applications, and anything that runs in a Hyper-V VM. I run a FreeBSD VM on Hyper-V on my work desktop and can quite happily display graphical apps forwarded over SSH.

    One of the nice things about WSL1 is that you can run an X11 terminal, but still then run cmd.exe or powershell.exe to get a Windows command prompt (the new Windows terminal is coming along well, but I still don't like it quite as much as some more mature *NIX ones. Sorry Dustin!). I use this to run Konsole, edit code in vim, and then run the .bat file that Visual Studio installs to set up command-line paths correctly and then build with cmake + Ninja, all from within a terminal.

    WSL and WSL2 both natively support fork, so process creation costs are low (the hoops Cygwin jumps through to make fork work are slightly terrifying and incredibly slow: if you've ever run a configure script in Cygwin then you'll have seen this). Cygwin is a POSIX compatibility layer, WSL is a Linux compatibility layer, so software written by muppets who don't think about portability (also known as 'Linux programmers') is more likely to work. WSL2 gives faster disk I/O and better Linux compatibility (it *is* Linux), so things like Docker that abuse weird corner cases of very Linux-specific APIs work. The main thing you lose relative to Cygwin is the ability to mix Win32 / UWP and POSIX code in the same process (which, it turns out, few people actually want to do). If you just want an X server, you don't need any of them.

    I haven't tried WSL2 yet. I'm hopeful that the tight integration work on the Windows side will make it possible to have a FreeBSD version (some folks on the Hyper-V team tell me it should be relatively easy, but they don't have engineer time to devote to it). I miss control-t when I have to use Linux...

    sudo mod me up
    Starting Score:    1  point
    Moderation   +3  
       Informative=2, Underrated=1, Total=3
    Extra 'Informative' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   5  
  • (Score: 2) by dltaylor on Monday March 16 2020, @01:23AM (1 child)

    by dltaylor (4693) on Monday March 16 2020, @01:23AM (#971746)

    Those are the kind of trade-offs I was concerned about. The "shim" I mentioned was reallt WSL, but the WSL 2 is a different beast.

    Although it was initially the X server, shell (and associated tools), and ssh, I usually use Cygwin now to do things Windows makes either more trouble than necessary or impossible, or just to use the same tool there as on other *NIX. Raw device access, for example checksumming an entire CD, is still easy on a Cygwin/bash command line.

    I thought FreeBSD already ran in VMs. Is it "just" a matter of integrating with the new "free" setup or something else?

    • (Score: 2) by TheRaven on Monday March 16 2020, @09:38AM

      by TheRaven (270) on Monday March 16 2020, @09:38AM (#971827) Journal

      I thought FreeBSD already ran in VMs. Is it "just" a matter of integrating with the new "free" setup or something else?

      It runs very well in Hyper-V (locally and in Azure), but WSL2 has a bunch of integration hooks. I believe FreeBSD has a 9p-over-VirtIO driver under review, but it's not landed yet. Once this is in, 9p-over-VMBus is a relatively simple change (same messages, different link-layer protocol, but FreeBSD already has VMBus support). That's needed for the transparent file sharing thing (the Windows filesystem is exposed in WSL as /mnt/c, /mnt/d, and so on. In WSL2 these are 9p-over-VMBus filesystems). I think there are a few other glue things that may be needed. I haven't tried it with WSL2, but I believe Linux supports the Hyper-V virtual sound interface, which means that command-line WSL2 applications should be able to open /dev/dsp and make sounds, whereas FreeBSD is missing that driver (I don't care too much about this one, but it would be nice to have).

      Last time I spoke to anyone on the Hyper-V team working on this, they were interested in supporting other operating systems, but Linux is the thing customers care about so it's the highest priority.

      sudo mod me up