The fundamental difference between WSL2 and its predecessor lies in the architecture of the software. While WSL1 provided a compatibility layer for translating code execution between Windows and Linux, WSL2 relies on the virtualization of a Linux operating system. The virtual machine used for this runs on the native Windows hypervisor, hyper-V.
While the functionality of the Linux interface provided by WSL1 was limited, WSL2 uses a complete Linux kernel. This is a kernel specially optimized for WSL2 both in terms of size and performance and is based on the stable original code from “kernel.org”. In use, this is reflected in the faster code execution by a factor of about two to twenty. Furthermore, WSL2 requires less memory than the previous version. That the kernel is maintained as part of the regular Windows updates makes it more convenient for its users, too.
Since WSL1 uses a translation layer to mediate between Linux and Windows, some specialized Linux software is left out in this version of WSL. In contrast, WSL2’s kernel virtualization performs full system call compatibility. In practice, this means that even complex software like Docker can be operated within WSL2. Furthermore, the GPU can be accessed from the Linux environment, which is particularly useful for applications with large datasets such as machine learning and data science.