Recently, Microsoft had launched the Windows Subsystem for Linux 2, also known as WSL 2. Earlier, the Window OS had WSL 1 in it, but it was too buggy and developers found it very difficult to run their code on it. Hence Microsoft had stopped the WSL 1 for a while until all bugs were fixed. And now, it is back with the latest, bug-free WSL 2.
What is WSL?
Before getting to know more about what’s new in WSL 2, first, we must get to know what is WSL.
The Windows Subsystem for Linux, also known as WSL is an optional feature of the Windows 10 OS, that allows Linux programs to run independently on Windows platform reducing the need to use Linux platform for developers to run their code.
WSL was developed by Microsoft, in partnership with Canonical. These companies together created a compatibility layer for Windows that allows Linux programs to run in the Windows 10 version of the Bash Shell.
Usage of WSL and its fallout
WSL 1 is used by Windows that gives the user access to powerful programs that are available in Linux which includes GNU Tools such as “find, awk, sed, and grep” which can “locate, search, and modify” the contents of files.
WSL 1 is also used to import thousands of Linux Commands that can be used in Windows.
But, WSL 1 received a lot of negative reviews from a lot of developers who tried using it. This is due to the fact that though WSL 1 was much faster, Windows kernel Engineers found difficulty in trying to increase WSL 1’s performance and syscall compatibility by reshaping the existing NT Kernel which led to a lot of complications.
This fallout led to the introduction of WSL 2, which is very much faster when compared to its predecessor, the WSL 1. The WSL 1 was merely acting as a compatibility layer feature on Windows to allow running Linux programs on it. Whereas, WSL 2 raised the bar and brought the actual Linux kernel to Windows 10 through this new feature upgrade.
What is WSL 2
WSL 2 is the latest upgrade to the Windows OS which introduces the Linux Kernel to Windows 10. This was released on June 12, 2019, as a part of Windows Insider Preview Build 18917.
WSL 2 also offers greater performance when compared to its predecessor WSL 1. Also, it offers more speed than WSL 1. Moreover, all the bugs found in the WSL 1 are fixed in WSL 2.
What’s new in WSL 2
As mentioned before, WSL 2 brings the actual Linux Kernel to Windows 10 making it totally compatible to run Linux programs on Windows.
WSL 2 can now run all file intensive operations like “git clone, apt update, npm install” and a lot more operations at very high speeds and it varies according to your system configuration.
WSL 2 has made optimizations to run the Linux programs 20 times faster than its predecessor, the WSL 1. If you are using a Git Clone, then WSL 2 can run it 2 to 5 times faster than WSL 1.
When it comes to system call compatibility, the WSL 2 has made some considerable changes to it. When using the WSL 1, system call compatibility was the main challenge the Windows kernel developers faced during the bug fix period. They tried improving the WSL 1 to be compatible with system calls but ended in vain. But with WSL 2, due to the implementation of the actual Linux Kernel in it, now WSL is totally compatible with system call functions.
Also, all the Linux kernel updates can be automatically installed to the WSL 2. This means that you do not have to wait for the WSL team to implement the changes that you have already added to the update installed.
WSL 2 vs Actual Linux
Although WSL 2 is fast and can perform all Linux operations on Windows, yet it cannot match working with the actual Linux OS. This is due to the following reasons.
- WSL 2 is a virtual run subsystem for Windows used merely as a feature whereas, Linux OS is the actual OS that runs on any device.
- Linux is an open-source OS whereas Microsoft is a proprietary or paid license OS.
- Running programs on Linux is very fast when compared with running on WSL 2
- WSL 2 virtually uses the OS Kernel whereas Linux actually uses the kernel of the Linux OS to run the programs.
- The architecture of Linux is very much simple when compared to the architecture of WSL 2 on Windows 10.
- Linux, in general, is free from bugs whereas WSL contains a considerable amount of bugs in it that can be fixed.
- Linux mostly emphasizes on a single-user OS environment whereas WSL 2 focuses on multiple-user shared OS environment.
All these points are the challenges that the Microsoft WSL kernel has in order to beat Linux and become the best operating kernel for developers.
WSL 2 and its Advantages
Even though it cannot match the performance of Linux kernel OS, yet WSL 2 has its own set of advantages that makes it superior to any other subsystem other than Linux. Some of the important advantages include,
- WSL 2 is really fast when compared with any other subsystem
- With the Linux kernel, WSL 2 can run almost any program or any operation easily which is not possible in all subsystems
- WSL 2 is made compatible with system call functions when compared to any other subsystem
And many more…
To conclude, WSL 2 is in many ways superior to its predecessor, the WSL 1 and any other subsystem created around the world. But still, it has a lot more room to grow upon and further updates might just do the trick in beating Linux.
As a whole, for core developers and programmers who use the Windows OS, we can easily say that they are definitely in for a big treat through the introduction of this feature to the existing OS.