As we had discussed last month about WSL2 along with the features that would be implemented in it at its launch, Microsoft has announced the formation of new experimental builds of Windows Insider (build 18917), including the WSL2 layer (Windows Subsystem for Linux).
WSL2 is a layer that enables the launch of Linux executable files on Windows. WSL Second Edition distinguishes itself by delivering a full-fledged Linux kernel, rather than an on-the-fly emulator that translates Linux system calls into Windows system calls.
Using a regular Linux kernel allows WSL2 to achieve full Linux compatibility at the system call level and ensure that Docker containers can run smoothly on Windows, as well as implement support for file systems based on the FUSE mechanism.
Compared to the previous version (WSL1), this second version (WSL2) has significantly improved I / O performance and file system operations.
For example, when unpacking a WSL2 archive it is 20 times faster than WSL1, and when some of the different operations are performed on it, such as "git clone", "npm install", "apt install" and apt update " 2 to 5 times.
WSL2 offers a component based on Linux kernel 4.19 running in a Windows environment using a virtual machine that is already used in Azure.
There are some user experience changes that you will notice when you start using WSL 2.
Updates for the Linux kernel are delivered through the Windows update mechanism and are tested on Microsoft's continuous integration infrastructure.
All changes prepared for kernel integration with WSL promise to release under the free GPLv2 license.
Prepared patches include optimizations to reduce kernel startup time, reduce memory consumption, and leave the minimum required set of drivers and subsystems in the kernel.
What's new in WSL2?
Support for the previous version of WSL1 is preserved and both systems can be used in parallel, according to user preferences. WSL2 can act as a transparent replacement for WSL1.
As in WSL1, the user space components are installed separately and are based on sets from various distributions. For example, pFor installation in WSL in the Microsoft store directory, some suggested distributions as are Ubuntu, Debian, Kali Linux, Fedora, Alpine, SUSE, and openSUSE.
The environment is done on a separate disk image (VHD) with an ext4 file system and a virtual network adapter.
To interact with the Linux kernel proposed in WSL2, a small initialization script needs to be included in the distribution change the boot process.
A new command "wsl –set-version" has been proposed to change the distribution modes, and a command "wsl –set-default-version" to select the default version of WSL.
Also this new version of WSL2 included in the Windows build 18917 build, file system enhancements highlighted since within them the handling of these was optimized making access to them faster.
We understand that we've spent the last three years telling you to put your files on your C drive when using WSL 1, but this is not the case on WSL 2. To enjoy the fastest file system access in WSL 2, these files must be within. Linux root file system.
Another change in WSL2 is the change in architecture through virtualization technology.
Since WSL 2 now runs in a virtual machine, the IP address of that virtual machine will need to be used to access Linux network applications from Windows, and vice versa.
Our goal is to make WSL 2 feel like WSL 1, and we look forward to hearing your feedback on how we can improve.