BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Windows Subsystem for Linux 2 Has Linux Kernel Shipping in Windows

Windows Subsystem for Linux 2 Has Linux Kernel Shipping in Windows

Bookmarks

Windows announced that Windows Subsystem for Linux (WSL) 2 is now available through the Windows Insiders program. WSL allows developers to run a Linux environment, including most command line tools and utilities, directly within Windows. WSL 2 presents a new architecture that aims to increase file system performance and provide full system call compatibility.

Available in build 18917 in the Insider Fast ring, Windows will now be shipping with a full Linux kernel. This change allows WSL 2 to run inside a VM and provide full access to Linux system calls. Windows will be building the Linux kernel in-house from the latest stable branch based on the source code available from kernel.org. The initial builds will ship with version 4.19 of the kernel. The kernel will be specifically tuned for WSL 2 and will be fully open sourced with the full configuration available on GitHub. This change allows for faster turnaround on updating the kernel when new versions become available.

WSL 2 represents a change in architecture from WSL 1 by running inside a virtual machine, however the development team indicates that the benefits of WSL 1 will still exist. As Craig Loewen, program manager with the Windows Developer Platform, notes:

WSL 2 will NOT be a traditional VM experience. When you think of a VM, you probably think of something that is slow to boot up, exists in a very isolated environment, consumes lots of computer resources and requires your time to manage it. WSL 2 does not have these attributes. It will still give the remarkable benefits of WSL 1: high levels of integration between Windows and Linux, extremely fast boot times, small resource footprint, and best of all will require no VM configuration or management.

Within WSL 1 a translation layer was used to interpret most Linux system calls and allows them to run within the Windows NT kernel. This meant that some Linux applications were not available due to the challenge in implementing the system calls. With the inclusion of the Linux kernel with WSL 2 and full system call compatibility, a number of new applications are now available for use within WSL including the Linux version of Docker and FUSE.

Benchmarking performed by the development team has shown noticeable improvements with file intensive operations such as git clone, npm install, or apt update. According to Loewen, "Initial tests that we've run have WSL 2 running up to 20x faster, compared to WSL 1 when unpacking a zipped tarball, and around 2-5x faster when using git clone, npm install and cmake on various projects."

The team attempted to maintain the user experience of WSL 1 with WSL 2, however there were some key changes. The largest change is that files that will be frequently accessed should now be put inside the Linux root file system to take advantage of new file performance benefits. This is a change of direction from WSL 1, where it was recommended that these files be put into the C drive. With this change, it is now possible for Windows apps to access the Linux root file system. For example, running explorer.exe . in the home directory of the Linux distro will now open File Explorer at that location.

Since WSL 2 now runs in a VM, you need to use the VM's IP address to access Linux networking applications from Windows. As well, the Windows Host IP will be needed to access Windows networking applications from within Linux. The team has plans to include the ability to access network applications via localhost in the near future.

Linux distros can be run using either WSL 1 or WSL 2 and can be upgraded and downgraded between the two versions. New commands were added to facilitate setting the version: wsl --set-version <distro> <version>; this command allows you to convert an existing distro to use either the WSL 2 or the WSL 1 architecture (by specifying 1 or 2 for the version). The command wsl --set-default-version <version> will allow you to specify the initial version (either WSL 1 or 2) for new distributions.

WSL 2 is available starting in build 18917 in the Windows Insiders program. The team has provided a document outlining the additional user experience changes between WSL 1 and WSL 2. Users who wish to raise an issue or have feedback for the development team are invited to file an issue on GitHub. Some of the team members are also available via Twitter to help with general questions.

Rate this Article

Adoption
Style

BT