Microsoft has opened the source code of a set of tools that provide the Windows Subsystem for Linux (WSL) for running Linux applications on Windows. Now anyone can build WSL from source code, take part in its development — and Microsoft has already started accepting corrections and suggestions for new features from the community. The subsystem code is published under the MIT license, and a special website has been launched for developers — wsl.dev.
Image source: Microsoft
The WSL subsystem provides a virtual machine with a Linux kernel for running WSL applications. The kernel contains WSL-specific changes, including optimizations aimed at reducing startup time and memory consumption, as well as support for returning memory freed by Linux processes to Windows, and other improvements. The system is installed in a separate disk image with an ext4 file system and a virtual network adapter. WSL components are linked to the Linux kernel and the WSLg graphics stack.
Among the open components were the command line utilities wsl.exe, wslconfig.exe and wslg.exe, designed to interact with WSL, as well as the wslservice.exe service, which is responsible for launching the virtual machine, activating the Linux environment and mounting the file system. In addition, background processes were opened that ensure the operation of the Linux environment and access to WSL functions.
However, some components remained part of Windows and were not exposed: the Lxcore.sys kernel driver (used to run ELF executables through the compatibility layer), the P9rdr.sys driver, and the p9np.dll library.
In addition, Microsoft has also opened the source code of the console text editor Edit, distributed under the MIT license. It is written in the Rust language and is intended for delivery in 64-bit versions of Windows. In the coming months, the editor will appear in test builds of the OS as part of the Windows Insider program, and will later become part of Windows 11. The developers are striving to implement a modern and intuitive interface in Edit, convenient even for users who do not have experience working in the terminal.