Microsoft Windows Subsystem for Linux (WSL)
Microsoft Windows Subsystem for Linux (WSL) is a series of Microsoft components that allow native Linux 64-bit Executable and Linkable Format (ELF64) binaries to run on the Windows kernel in the Windows 10 operating system (OS).
After enabling the Windows Subsystem for Linux feature in Windows 10, the Linux bash shell can be run to install the Ubuntu user-mode image that runs on top of the Windows kernel layer that allows ELF64 binaries to operate in Windows. After installation, users can run other files from the Ubuntu package repository; Linux command-line utilities such as grep, sed and awk; navigate the Linux file system; and execute scripts using command-line interface (CLI) utilities.
WSL includes a user-mode session manager service to handle the Linux instance, minimized Pico processes to handle Linux system calls and Pico drivers to emulate the Linux kernel. As a whole, this architecture enables Linux system calls to be passed into and handled by the Windows kernel.
Who should use WSL?
Windows Subsystem for Linux is primarily for Linux developers operating in a Windows environment. For example, web developers who often use Linux and other open source tools from sources such as GitHub but have limited access to full Linux systems for development and experimentation. Windows Subsystem for Linux lets developers use common Linux tools and advanced development languages, such as Ruby and Python, to operate through Windows.
WSL 1 vs. WSL 2
Microsoft offers two different versions of Windows Subsystem for Linux: WSL 1 and the newer WSL 2. Both offer integration between Windows and Linux. Both are also lightweight and offer fast boot times. WSL 1 and WSL 2 both also work with non-Microsoft hypervisors such as VMware and Oracle VM VirtualBox.
One of the key differences between WSL 1 and WSL 2 is that WSL 2 runs inside of a managed virtual machine (VM). Because the VM is managed, IT pros do not have to worry about performing configuration or management tasks that are often associated with virtual machines.
Another key difference is that WSL 2 runs a full Linux kernel. Because this kernel was built by Microsoft, it is kept up to date by Windows Update.
Microsoft generally recommends using WSL 2 because it offers better performance than WSL 1 and has 100% system call compatibility, which means you can run apps such as Docker. However, you will need to continue using WSL 1 if your project must be stored on the Windows File System or if a project requires cross-compilation using both Windows and Linux tools.
FAQs for WSL
A few common questions on WSL include the following.
Why should Windows Subsystem for Linux be run instead of Linux in a VM?
While Linux instances can run in Windows inside a VM, Windows Subsystem for Linux offers two advantages. First, it requires less overhead on computing resources -- processor, memory and storage -- than a full VM. Second, WSL allows both Windows and Linux environments to run simultaneously, so developers can use Windows applications and Linux utilities on the same files if needed.
Does Windows Subsystem for Linux have any limitations?
Windows Subsystem for Linux currently has several limitations. First, it does not support all Linux applications; it is intended to provide a tool to handle bash and major Linux command-line utilities. WSL does not support Linux graphical user interface (GUI) environments such as Gnome or K Desktop Environment. Windows Subsystem for Linux only supports the Ubuntu Linux distribution at this time.
In addition, Windows Subsystem for Linux is only available for Windows 10 and will not be available in Windows Server versions. While WSL can run some Linux server applications, such as Redis as a database, it is not intended to host Linux server applications.
What file systems does Windows File System for Linux support?
Windows Subsystem for Linux employs two file systems to support Linux file conventions while providing interoperability with Windows files. A file system called VolFs supports Linux file conventions including Linux permissions, links to other files, names with characters not normally accepted under Windows and the Linux directory structure. However, VolFs does not support interoperability between its files and Windows applications, but another file system called DriveFs provides that interoperability, ensuring legal Windows file names, enforcing Windows security and supporting case-sensitive file names. The directory structure of DriveFs allows users to apply either Windows or Linux tools to files at the same time.