Microsoft released Windows Subsystem 2.0 to the general public. Although it has been available for a while to insider builds it has been a long wait to reach the main release channels.
What is Windows Subsystem For Linux
Before I talk about 2.0, let me explain what Windows Subsystem For Linux is (WSL)
Microsoft Windows has always maintained some form of Linux compatibility, but it has always been very basic until WSL was announced.
WSL enables support for a full-blown Linux install inside your Windows Desktop. What makes WSL stand out is that it is not an emulator. WSL runs native Linux binaries right in Windows.
There are some limitations to WSL though you should be aware of, it does not have direct access to the hardware so you cannot do things like run X Windows GUI programs, gaming, GPU machine learning, or anything that needs direct access to devices. While this is a big limitation, for 98% of use cases this is not a roadblock.
WSL runs a full distribution of Linux, you can choose from any of the following:
- Ubuntu
- openSUSE Leap
- SUSE Linux Enterprise Server
- Kali Linux
- Debian Linux
You can find the actual distribution in the Windows Store but first, you need to install WSL support before you can use it.
What is new with Windows Subsystem for Linux 2.0
While WSL 1.0 works great and will allow you to have a full Linux based development environment inside of Windows, 2.0 adds some nice features.
Full Linux Kernel
Microsoft has built a full kernel for WSL 2.0 with optimizations for WSL. This allows for greater speed and smaller size than WSL 1.0. It also allows Microsoft to provide updates to the kernel automatically.
Managed VM
This is the feature I have been really excited about. While on the surface it isn't a huge change, combined with a full Linux kernel, you can now run Linux containers (i.e. Docker) with full native support.
Docker was always wonky on Windows, with WSL 2.0 this becomes seamless and efficient.
Full System Call Compatibility
While WSL 1.0 was natively executing Linux binaries, it still required a translation layer to manage system calls. WSL 2.0 now supports a full Linux kernel avoiding the need for a translation layer.
This allows you to use a wider range of Linux applications and quicker access to newer Linux kernels.
These three features allowed for native Docker support to be added.
I/O Performance
I/O performance has been greatly improved with WSL 2.0. Performance has been increased as much as 20x over WSL 1.0. One of the things I hated about WSL 1.0 is how slow things like git, npm, and apt were. This improves these types of applications dramatically.
If you haven't used WSL yet, it is really one of the greatest things Microsoft has done in the last 10 years (outside of VS Code).
I'll continue this tutorial in future posts over the next few days to cover installation, upgrading, and using WSL. I got a really cool trick that will blow your mind in the 2nd or 3rd post in this series.
If you use Windows and you are a developer, you owe it to yourself to check out WSL.
Securely chat with me on Keybase