Difference between wsl2 and virtual machines?

I still don’t understand the main difference between wsl2 and virtual machine. I mean I have them both installed on my windows machine but I usually get confused that which one should I use mainly. Any specific advantages or disadvantages of using wsl over vm or vice versa?

Both WSL2 and VM have their own advantages and disadvantages tbh. WSL2 uses a linux kernel supplied by Microsoft in order to integrate with Windows and thus, you’d have a native feel of using Linux within Windows ecosystem. It’s best if you want to just run simple Linux apps and development stuff.

On other hand, Linux in a VM is full-fledged, the kernel is given by the Linux distro and you can run any kind of GUI without any flaws (of course, this purely depends on the memory you allocate to VM). Best for development purposes in pure linux ecosystem.

So to summarize, if you’re looking for a full linux ecosystem to work without having to dual boot, then use VMs. Else, WSL2 is a viable option.

1 Like