Microsoft is creating a level playing field for Developers, Sysadmins and DevOps engineers using different platforms.

Microsoft is bringing its tools and utilities to macOS and Linux, while bringing UNIX/Linux utilities to its Windows. Users can now fire up a bash shell in Windows and run most Linux/UNIX command natively.

But why does Microsoft care about Linux on Windows, a platform that still dominates the PC market?

While Windows is a dominant platform in the PC space and developer space, the world runs on Linux, whether it’s super computers or tiny IoT devices. Microsoft’s own Azure Sphere OS, an operating system for IoT devices runs on Linux.

DevOps engineers, developers, sysadmin need tools to develop for and manage their workloads running on Linux. They need Linux tools and utilities running on their development platforms, that happen to be their laptops. They can either use dedicated Desktop Linux machines, which has its own limitations as a desktop platform. They can run Linux in a VM on Windows, which leads to overhead and poor performance or most resort to using MacOS that is UNIX and comes with all such utilities natively.

In either case, Windows is not an ideal solution. It needs all of these capabilities natively. Microsoft engineers came out with a clever solution called WSL (Windows Subsystem for Linux) that brought Linux utilities and tools to Windows, natively, without needing the Linux kernel. Users were able to run many Linux utilities and tools in Windows, eliminating the need of dedicated Linux machine or resource hungry VMs.

But WSL had its own limitations due to lack of the Linux kernel. “Our top requests from the WSL community have been to increase the file system performance, and make more apps work inside of WSL (i.e: introduce better system call compatibility),” said Craig Loewen, Program Manager, Windows Developer Platform at Microsoft.

At the Microsoft BUILD 2019 conference, the company announced WSL 2, the next iteration of WSL that brings the Linux kernel to Windows. Yes, you heard it right soon Windows will be running Linux.

The entirely new architecture of WSL 2 uses a real Linux kernel to run ELF64 (Executable and Linkable Format) Linux binaries on Windows. “This new architecture changes how these Linux binaries interact with Windows and your computer’s hardware, but still provides the same user experience as in WSL 1,” explained Loewen.

Microsoft is using the source code for Linux kernel 4.19 to create a fully customized, in-house kernel that is optimized for size and performance for WSL 2.

According to Loewen, “File intensive operations like git clonenpm installapt updateapt upgrade, and more will all be noticeably faster. The actual speed increase will depend on which app you’re running and how it is interacting with the file system. Initial tests that we’ve run have WSL 2 running up to 20x fastercompared to WSL 1 when unpacking a zipped tarball, and around 2-5x faster when using git clone, npm install and cmake on various projects.”

Microsoft will take care of updating the Linux kernel through Windows updates, which means users won’t have to worry about manually updating it.

“This Linux kernel will be fully open source! When we release WSL 2 we will have the full configuration available online on Github, so you can see how it works and build it yourself,” said Jack Hammons Program Manager, Linux Systems Group at Microsoft.

As a result of this work, users will be able to use system calls to perform many functions such as accessing files, requesting memory, creating processes, and more.

“In WSL 1 we created a translation layer that interprets many of these system calls and allows them to work on the Windows NT kernel. However, it’s challenging to implement all of these system calls, resulting in some apps being unable to run in WSL 1. Now that WSL 2 includes its own Linux kernel it has full system call compatibility. This introduces a whole new set of apps that you can run inside of WSL. Some exciting examples are the Linux version of Docker, as well as FUSE!” said Loewen.

Users will be able to install WSL 2 in June.

Get latest updates in your inbox, subscibe to our daily newsletter.

Do YOU ❤ TFIR? Become a Patron and sponsor our work!

Swapnil Bhartiya
I have more than 12 years of experience covering Enterprise Open Source, Cloud, Containers, IoT, Machine Learning and general tech. My stories cover a very broad spectrum - traditional Linux, data center and Free Software to contemporary emerging technologies like 'serverless'. Widely Read: My stories have appeared in a multitude of leading publications including CIO, InfoWorld, Network World, The New Stack, Linux Pro Magazine, ADMIN Magazine, HPE Insights, Raspberry Pi Geek Magazine, SweetCode, Linux For You, Electronics For You and more.