There's been some really exciting news from Microsoft about the Windows Subsystem for Linux, or WSL for short. After years of work, Microsoft has made the code that powers WSL publicly available. Yes, You read that right. Windows Subsystem for Linux (WSL) is now officially Open Source!
This is a big step, especially when you think about how things used to be.
Not every single part of WSL is open yet, like some of the older code or parts that help Windows and Linux files talk to each other smoothly. But a big chunk of the core is now open.
Table of Contents
What Exactly is WSL?
Imagine you have a Windows computer, but you also need to use tools that work best on Linux. Maybe you're a developer working on open source projects. In the past, you might have needed a separate Linux computer or a virtual machine.
WSL changes that.
The Windows Subsystem for Linux (WSL) is a special feature built right into Windows that lets you run Linux just like another app.
You can use Linux programs, work with Linux files, and use popular Linux command-line tools like Bash, sed, and awk, all directly on your Windows machine.
You can even run GUI applications directly using the latest WSL2 version.
Forget the hassle of setting up complex virtual machines or dual-booting your computer.
WSL is designed to provide a seamless and productive experience for developers who want to use both Windows and Linux at the same time.
WSL 1 vs WSL 2
There are two main versions: WSL 1 and WSL 2. WSL 2 is the current default version when you install a Linux distribution.
WSL 1
- The original version, WSL 1, was based on a technology that allowed Windows to natively run Linux Executable (ELF) binaries.
- It used a kernel-side driver called
lxcore.systhat enabled Windows to implement Linux system calls directly within the Windows kernel. - WSL 1 is still supported, although WSL 2 is generally recommended.
WSL 2
- WSL 2 represents a major overhaul of the underlying architecture compared to WSL 1.
- Instead of implementing Linux system calls within the Windows kernel, WSL 2 uses virtualization technology to run a full Linux kernel inside a lightweight utility virtual machine (VM).
- This VM is managed and runs behind the scenes. It offers the benefits of WSL 1, like seamless integration and fast boot times, but with the advantages of a real Linux kernel.
- Linux distributions run as isolated containers inside this managed VM.
- A key goal of WSL 2 was to increase file system performance (primarily for files within the Linux filesystem) and add full system call compatibility. While WSL 2 generally outperforms WSL 1, accessing files located on the Windows filesystem from within WSL 2 can be slower compared to doing so in WSL 1. Storing project files on the same operating system as the tools you are using is recommended to avoid these performance issues.
- WSL 2 utilises the Hyper-V hypervisor technology built into Windows.
WSL Core Components
To understand how WSL works under the hood, it's important to know about the WSL core components.
The code that powers WSL is made up of different parts, some running in Windows and some inside the WSL 2 VM.
- Command line executables: Tools like
wsl.exe,wslconfig.exe, andwslg.exeare the entry points for interacting with WSL. - The WSL service: This Windows service is responsible for starting the WSL VM, launching distributions, and managing file access shares.
- Linux processes: Binaries like
init,gns(for networking), andlocalhostrun within the Linux environment to provide core WSL functionality. - Plan9 file server: An implementation running in Linux that handles sharing Linux files so they can be accessed from Windows (e.g., via
\\wsl.localhost).
In essence, WSL, especially WSL 2, provides a highly integrated environment by combining a lightweight VM running a genuine Linux kernel with Windows-side components and services to create a seamless developer workflow.
The open-sourcing of significant parts of WSL now allows the community to contribute directly to its development.
What Parts of WSL are Now Open Source and What's Not?
Now, the core pieces of WSL are open source. Microsoft has shared the code for some very important parts.
WSL Components that HAVE Been Open Sourced:
Specifically, the code for the Linux kernel used in the latest version, WSL 2, is now public. Microsoft builds this kernel themselves, making it work well with Windows. Also, the main WSL platform code is open.
There's also a part called WSLg (Windows Subsystem for Linux GUI). This is a cool feature that lets you run Linux apps with windows and buttons right on your Windows desktop.
You can even copy and paste between Windows and Linux apps easily. The code for WSLg is now open source too.
Most of this code is available under the MIT License. This is a license that lets people use and share the code very freely.
WSL Components that Have NOT Been Open Sourced
As mentioned already, not all components of the Windows Subsystem for Linux (WSL) have been open-sourced at this time.
Lxcore.sys: This is the kernel side driver that powers WSL 1. While WSL 2 is the default and recommended architecture, WSL 1 is still supported and has not been deprecated. Some users specifically desired this part to be open.P9rdr.sysandp9np.dll: These components run the filesystem redirection that allows accessing Linux files from Windows using the\\wsl.localhostpath.
So, while major parts like the core platform, the WSL 2 kernel, and GUI support (WSLg) are now open, some key Windows-side components, particularly those related to the older WSL 1 architecture and the Windows-to-Linux file access redirection, remain closed source at this time.
Benefits of Open Source WSL
Making WSL open source is very beneficial for a few reasons:
- More Eyes on the Code: Now that anyone can look at the code, it's easier to spot problems or figure out how things work.
- Community Power: The people who use WSL have already helped a lot by finding bugs and suggesting features. With the code open, they can now directly help fix problems and add new features.
- Faster Progress: Moving WSL development outside of the main Windows system and making it open source helps it update more quickly.
WSL 2 itself was a big step when it came out, using a lightweight virtual machine to make sure it works just like real Linux. This open-sourcing is another big step forward.
Microsoft is really excited about how the community can help WSL get even better!
Community Reaction
This news has started a lot of conversations on multiple discussion forums and social media!
Many people are very happy and excited. They see it as a great way to make WSL more stable and add features. Some developers say WSL is essential for their work, giving them the best of both Windows and Linux.
However, some people are still cautious. Given Microsoft's history with Linux, some worry about their true goals.
Others point out issues, like how slow it can sometimes be to work with Windows files from inside WSL.
Some also find the name "Windows Subsystem for Linux" a bit confusing, suggesting "Linux Subsystem for Windows" might make more sense.
Related Read: Install Windows Subsystem For Linux With Single Command
Conclusion
Making WSL open source is a major event. It shows how much Microsoft has changed over the years.
By opening the code for the core WSL platform, the WSL 2 kernel, and WSLg, Microsoft is inviting everyone to help shape the future of running Linux on Windows.
This could lead to a better, more stable, and more feature-rich WSL experience for everyone who uses it.
Indeed, Microsoft Loves Linux!
Resource:
