Microsoft announces the newest architecture for the Windows Subsystem for Linux: WSL 2

Although Windows Subsystem for Linux (WSL) 1 was introduced in 2016, the community has been demanding improved file system performance with better system call compatibility, allowing more applications to work inside WSL. To resolve these problems, Microsoft is introducing the latest architecture for Windows Subsystem for Linux: WSL 2. The new WSL 2 uses a completely new architecture, using a real Linux kernel, to run ELF64 Linux binaries on Windows. The new architecture changes the way these Linux binaries interact with Windows and computer hardware, but still provides WSL 1 has the same user experience. A single Linux distribution can be run either as a WSL 1 release or as a WSL 2 release, can be upgraded or downgraded at any time, and can run WSL 1 and WSL 2 releases in parallel.

Linux binaries use system calls to perform many functions, such as accessing files, requesting memory, and creating processes. WSL 1 creates a translation layer that translates this system calls to allow them to work on the Windows NT kernel. However, implementing all of these system calls is challenging, and some applications cannot run in WSL 1. Now WSL 2 includes its own Linux kernel with full system call compatibility. This introduces a new set of applications that can be run in WSL.

An example worth mentioning is the Linux version of Docker, and FUSE can be run in WSL 2. At the same time, using WSL 2 means that the latest improvements to the Linux kernel can be obtained faster than WSL 1 because the development team can simply update the WSL 2 kernel without having to reimplement the changes themselves.

Undoubtedly, the speed of WSL 2 is also significantly faster than the 1st generation! File-intensive operations such as git clone, npm install, apt update, and apt upgrade are significantly faster. The actual speed increase will depend on the application you are running and how it interacts with the file system. The initial tests run by the development team made WSL 2 20 times faster than WSL 1and when unpacking a zipped tarball, and around 2-5x faster when using git clone, npm install and cmake on various projects

The initial version of WSL 2 will be available through the Windows Insider Program at the end of June this year.