Earlier today, we wrote that Microsoft was going to add some big new features to the Windows Subsystem for Linux, including native support for Docker containers. It turns out that that ain’t the half of it.
The current Windows Subsystem for Linux uses a Microsoft-authored kernel component that provided the same kernel API as the Linux kernel but written from scratch by Microsoft.
All is changing with Windows Subsystem for Linux 2. Instead of emulating the Linux kernel APIs on the NT kernel, WSL 2 is going to run a full Linux kernel in a lightweight virtual machine. This kernel will be trimmed down and tailored to this particular use case, with stripped-down hardware support (since it will defer to the host Windows OS for that) and faster booting.
The Linux kernel is GPLed open source; the GPL license requires that any modifications made to the code must be published and made available under the GPL license. Microsoft will duly comply with this, publishing the patches and modifications it makes to the kernel. WSL 2 will also use a similar split as the current WSL does: the kernel component will be shipped with Windows while “personalities” as provided by the various Linux distributions can be installed from the Microsoft Store.
By using the Linux kernel itself, Microsoft gets all of Linux’s features for free. This is why WSL 2 will support Docker containers: all the underlying infrastructure, such as cgroups, is already in the Linux kernel, and Microsoft won’t need to implement the features itself. The embedded kernel will be serviced and updated by Windows Update.
This also provides a big bump to performance. File system-heavy operations such as extracting a tarball can be up to 20 times faster; other activities (such as cloning source code repositories in Git) will be perhaps five times faster.
WSL has already been warmly embraced by developers, as it gives a solid Linux-like development environment. WSL 2 will take that to a new level and all but eliminate the compatibility issues that WSL 1 has.
The first preview of WSL 2 is due to ship in June.