Microsoft today announced a new architecture for the Windows Subsystem for Linux: WSL 2. It will allow for dramatic file system performance increases, and full system call compatibility, meaning you can run more Linux apps in WSL 2 such as Docker.
WSL 2 is a new version of the architecture that powers the Windows Subsystem for Linux to run ELF64 Linux binaries on Windows. This new architecture changes how these Linux binaries interact with Windows and your computer’s hardware, but still provides the same user experience as in WSL 1 (the current widely available version). Individual Linux distros can be run either as a WSL 1 distro, or as a WSL 2 distro, can be upgraded or downgraded at any time, and you can run WSL 1 and WSL 2 distros side by side. WSL 2 uses an entirely new architecture that uses a real Linux kernel.
Shipping a Linux kernel with Windows
Microsoft is going to ship a real Linux kernel with Windows that will make full system call compatibility possible. This will be the first time a Linux kernel is shipped with Windows, built from the latest stable branch, based on the source available at kernel.org. In the initial builds, Microsoft will ship version 4.19 of the kernel.
This kernel has been specially tuned for WSL 2. It has been optimized for size and performance to give an amazing Linux experience on Windows. Microsoft will service this Linux kernel through Windows updates, which means you will get the latest security fixes and kernel improvements without needing to manage it yourself.
Lastly, of course this Linux kernel will be fully open source! When we release WSL 2, Microsoft will have the full configuration available online on Github, so you can see how it works and build it yourself.
The architectural changes in WSL 2
WSL 2 uses the latest and greatest in virtualization technology to run its Linux kernel inside of a lightweight utility virtual machine (VM). However, 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.
Here’s a quick demo of WSL 2 in action.
File intensive operations like
apt upgrade, and more will all be noticeably faster. According to Microsoft, WSL 2 is 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.
These improvements expand the scope of apps that you can run inside of WSL. New apps include the Linux version of Docker, as well as FUSE (Filesystem in Userspace).
Initial builds of WSL 2 will be available through the Windows Insider program by the end of June 2019.