DEV Community


Posted on

The Underlying Architecture of WSL and why is WSL 2 better

As we know, WSL or Windows Subsystem for Linux is a pretty handy tool, it helps you use the Linux command line on windows, no dual boot or partitioning required

Yeah I won't beat around the bush more, lets learn about its architecture

WSL versions

There are 2 versions of WSL now

  1. WSL 1: The more widely used version now
  2. WSL 2: The fairly newer and faster one

Both of them have fairly underlying architectures, so I will be explaining them separately


So WSL 1 works using a translation layer, it has unmodified binaries for applications such as apt, grep, etc

When these libraries make a system call, such as accessing memory or network, they would usually make a request to the Linux kernel, while in WSL, it requests the translation layer, the translation layer converts the UNIX system call to a call compatible with the Windows NT kernel.

This worked great but the problems are obvious, passing every system call through a translation layer would result in performance hits, and wouldn't have all of the system calls translated which may result in commands failing to execute due to an unmapped system call, this resulted in the making of WSL 2


The WSL 2 moved into a virtualization-based approach in which you have an actual Linux kernel sitting inside a very lightweight VM
powered by the Windows Hypervisor Platform. This made file IO much faster due to the avoidance of the translation layer

This resulted in full system call compatibility and much better performance overall


I am pretty sure this article gave you a rough understanding of how WSL works, I will link more comprehensive articles about the architecture but this is a high-level idea about the same

Some articles for the same include

btw, If you do find any factual errors, please comment about it below so I can correct them

This video was hugely inspired by This video by Microsoft, do check it out


Discussion (2)

lilkedus profile image
Kedus Leji Yared

Thanks for the article

akionsight profile image
AkIonSight Author

Thanks for reading