Before the introduction of virtualization technology, users had to dual boot Windows and Linux if they wanted to run both the operating systems on the same computer. Then, virtual machines came along and gave you more flexibility without having to reboot. And now you can run Windows and Linux at the same time using Windows Subsystem for Linux (WSL).

With so many choices available, it becomes hard to select the most appropriate one that suits your needs. Here we will discuss the difference between virtual machines and WSL in detail, and why you should choose one over another.

Linux Under a Virtual Machine

Arch Linux running in VirtualBox

Sometimes, running Linux in a virtual machine using a hypervisor like VirtualBox makes the most sense.

If you're learning Linux and want to get into the nitty-gritty of installing and configuring a Linux system, a virtual machine is the best option. If you're considering a career in IT, knowledge of these things will be crucial.

If you need access to graphical apps on Linux, a virtual machine is still a better bet at the moment, even as Microsoft promises support for GUI apps in WSL. If you want to try the different window managers and desktop environments that Linux has to offer, you have to use some workarounds with WSL in the stable version.

For those who want to try different distros, you'll also be better off using VMs. While WSL offers a choice of distributions, it's still limited in the Microsoft Store. While major distros like Ubuntu, Debian, openSUSE, and Alpine Linux, are available on WSL, other more obscure distros are less represented. Using a hypervisor like VirtualBox will give you a wider choice of distributions.

Linux isn't the only open-source operating system you can use in VirtualBox. You can run the BSDs and even FreeDOS.

Related: 9 Things You Should Do After Installing Ubuntu Linux in VirtualBox

Windows Subsystem for Linux

Ubuntu running under WSL

WSL is a good solution if you're completely new to Linux and don't want to contend with installing a Linux system and dual-booting. It's an easy way to learn the Linux command-line without having to learn a new operating system completely.

The overhead for running WSL is also much lower than with a full VM. While WSL 2 actually uses the Linux kernel running under Hyper-V, you won't have as much of a performance hit than with a VM because you aren't running most of the other processes that run on a Linux system. You can run WSL with less memory than you would need for a virtual machine.

If you just need command-line programs such as languages or compilers, WSL may be ideal for you. WSL is targeted toward developers, particularly those working in web development, as they don't need access to the kernel very often.

If you mostly use Windows while occasionally dipping into Linux, installing a full-blown Linux system makes less sense. It's also much faster to launch the WSL terminal than to start up a full VM.

WSL also integrates much more fully into Windows than a regular VM in VirtualBox does. While there are ways to integrate your Windows desktop and a Linux VM in VirtualBox, it can take some time to get it working properly.

Related: How to Run a Linux Desktop Using the Windows Subsystem for Linux

Now You Can Choose Between A Virtual Machine and WSL

If you need more direct access to the operating system itself, you should install Linux in a virtual machine under Windows. You'll have more control over the system this way.

For those who just want to use the command-line tools under Linux while still using Windows, WSL is a better bet. You won't have to spend time setting up your system just to use a few programs you really want. Just fire up a terminal window and get to work.

Perhaps you've just decided to dual boot, which was the classic solution to the need to run Linux and Windows on the same machine for many years. While it's still a valid approach, it does have some drawbacks that you should know about before getting practical.