WSL vs a Linux Virtual Machine: Which One Should You Use?
WSL or a Linux virtual machine? On one real Windows PC we ran Ubuntu both ways, WSL and a Hyper-V VM, and measured what matters: both started in about seven seconds (6.9 s vs 7.3 s), files on the C drive were about 40 times slower from WSL, other devices couldn't reach WSL until a port proxy, and after Windows restarted only the VM was still serving pages.
The speed guess
You want Linux on your Windows PC. You can use WSL, the Linux built into Windows, or a Linux virtual machine. Which one? Most people would bet on WSL for speed, so we timed both on the same PC. WSL: 6.9 seconds. The virtual machine took 7.3, counting until its web page answered. Less than half a second apart. That settles the speed argument, in about a second. Take Mike, who runs a small flower shop: his order page has to reach the counter tablet, and stay up through a restart. That's the real difference.

Two kinds of Linux on one PC
Here's what is really on a Windows PC running both. Guess first: is WSL a virtual machine too? Yes. Both are virtual machines: a computer made of software, running on Hyper-V, the part of Windows that runs virtual machines. WSL is one that Windows builds and runs for you. It starts the moment you type wsl, and stops when nobody uses it. The virtual machine is one you build yourself: its own disk, its own memory, its own network card. Think of WSL as a workbench in the back room of a shop, and the virtual machine as a second shop down the street, with its own address and opening hours.

Here's Mike's shop. This weekend is Mother's Day, and the order page has to be open on Trish's tablet at the counter by eight on Saturday, or the orders go on paper. He builds it on his Windows PC. So which of the two should run it?

You can see the difference with a few commands. wsl dash L dash V lists the Linux systems WSL has: here, Ubuntu, running, on WSL version two. uname dash R prints the kernel, the core of Linux that talks to the hardware. In WSL it ends in microsoft standard WSL two: Microsoft builds it, and every Linux you install in WSL shares it. Mike reaches the virtual machine with ssh, a remote terminal over the network. There it's Ubuntu's own kernel, the same one a real Ubuntu server would run.
PS C:\Users\mike> wsl -l -vNAME STATE VERSION * Ubuntu-24.04 Running 2
PS C:\Users\mike> wsl uname -r6.18.58.1-microsoft-standard-WSL2
PS C:\Users\mike> ssh mike@192.168.1.202 uname -r6.8.0-151-generic
Your programs run the same either way. What it changes for Mike is who updates the kernel. In WSL, Microsoft does. In the virtual machine, Ubuntu does, through apt, its package updater. And he can save the virtual machine as a checkpoint, a snapshot of the whole machine, before a risky change, and roll it back.

Files on the C drive
Mike's order system writes one small file per order. Inside WSL, in his Linux home folder, writing two thousand files takes 0.1 seconds. WSL can also open the Windows C drive, in a folder called slash mnt slash C. Same loop, there. Guess first: how much slower? About 40 times slower: 4.3 seconds.
mkdir ~/orders && cd ~/orders && time (for i in $(seq 1 2000); do echo "roses" > order$i.txt; done)real 0m0.097s user 0m0.016s sys 0m0.080s
mkdir /mnt/c/Users/mike/orders && cd /mnt/c/Users/mike/orders && time (for i in $(seq 1 2000); do echo "roses" > order$i.txt; done)real 0m4.347s user 0m0.036s sys 0m0.216s
Why? WSL's home folder lives on its own Linux disk, inside its virtual machine. The C drive belongs to Windows, so every file opened there crosses the wall between the two, one request at a time. Microsoft's own advice says it plainly: for the fastest performance, keep your files in the WSL file system when you work from Linux.

The virtual machine has the opposite problem. It can't see the C drive at all: there's no such folder. To share files with Windows, Mike would have to set up a network share. WSL's home folder, by contrast, even opens in Windows Explorer. So WSL wins easily for working on your own files, as long as they live on the Linux side.
ls /mnt/cls: cannot access '/mnt/c': No such file or directory
Memory
Mike's PC has eight gigabytes, and the shop's till software needs its share. So which one eats more? WSL may grow to half the PC, 3.8 gigabytes here, but it takes memory only as it needs it: right now it is using about 440 megabytes. The virtual machine holds all of its two gigabytes the whole time it runs, busy or not. So on Mike's PC, the virtual machine costs more memory, all day. And if WSL ever takes too much, you can cap it with one line in a settings file called dot WSL config.

Can the tablet reach it?
Now the part that decides it for Mike. He starts the order page in WSL with Python's small test web server, on port eight thousand, a numbered door for web traffic. On his own PC it opens fine: status two hundred, which means OK. Then Trish tries it from the counter tablet, using the PC's address on the shop network. She uses curl, which fetches a page. Nothing. After 9 seconds, it gives up.
cd ~/shop && python3 -m http.server 8000 &[1] 458
PS C:\Users\mike> curl.exe -s -o NUL -w "%{http_code}" http://localhost:8000200
curl -m 10 http://192.168.1.53:8000curl: (7) Failed to connect to 192.168.1.53 port 8000 after 9088 ms: Couldn't connect to server
Here's why. WSL sits on its own private network inside the PC, on an address only the PC can reach. Windows only passes on traffic the PC sends to itself, to local host, the PC's name for itself. That's why it worked on Mike's own PC. On the screen that's one two seven dot zero dot zero dot one. Trish's request arrives at the PC's shop address, and nothing there is listening.

First, Windows shows who listens on port eight thousand: only one two seven dot zero dot zero dot one. So Mike adds a port proxy: Windows listens on port eight thousand on every address and passes each connection on to WSL. Microsoft's own docs give this same fix. Windows also blocks new incoming connections by default, so a firewall rule lets that port in. Now Trish's tablet gets the order page.
PS C:\Users\mike> Get-NetTCPConnection -LocalPort 8000 -State Listen | ft LocalAddress,LocalPortLocalAddress LocalPort ------------ --------- 127.0.0.1 8000
PS C:\Users\mike> netsh interface portproxy add v4tov4 listenport=8000 listenaddress=0.0.0.0 connectport=8000 connectaddress=172.19.26.255
PS C:\Users\mike> New-NetFirewallRule -DisplayName 'Shop page 8000' -Direction Inbound -Protocol TCP -LocalPort 8000 -Action Allow | ft DisplayName,Enabled,ActionDisplayName Enabled Action ----------- ------- ------ Shop page 8000 True Allow
curl -s http://192.168.1.53:8000 | grep -o '<title>.*</title>'<title>Mike's Flowers: Mother's Day orders</title>
Newer versions of Windows 11 have an easier way. It's called mirrored networking, one line in that same dot WSL config file. WSL then shares the PC's own network addresses, so no proxy. Mike's PC runs an older Windows, so the proxy is his option. And with either one, WSL still has to be running to answer.

The virtual machine needs none of that. Hyper-V plugs its network card straight into the shop network, not behind Windows, so the shop's router gave it an address of its own: 192.168.1.202. The order page runs there as a service, a program the system keeps running. Trish types that address, and the page loads. No proxy, no extra rules.
ip -4 -br addr show eth0eth0 UP 192.168.1.202/24 metric 100
systemctl is-active shopactive
curl -s http://192.168.1.202:8000 | grep -o '<title>.*</title>'<title>Mike's Flowers: Mother's Day orders</title>
After a restart
Friday night, Windows installs its updates and restarts. Nobody signs in. Guess first: on Saturday morning, which one is serving orders? Only the virtual machine. Trish's tablet gets the page from it. From WSL, through the PC's address, it waits ten seconds and gets nothing.
PS C:\Users\mike> Restart-Computer
curl -s http://192.168.1.202:8000 | grep -o '<title>.*</title>'<title>Mike's Flowers: Mother's Day orders</title>
curl -m 10 http://192.168.1.53:8000curl: (28) Operation timed out after 10003 milliseconds with 0 bytes received
Windows tells us why. WSL's Ubuntu is stopped: it only starts when someone signed in to Windows uses it. Hyper-V started the virtual machine by itself, the moment Windows came up, because Mike had set it to start automatically. Inside it, the order page's service started at boot.
PS C:\Users\mike> wsl -l -vNAME STATE VERSION * Ubuntu-24.04 Stopped 2
PS C:\Users\mike> Get-VM shop-serverName State Uptime ---- ----- ------ shop-server Running 00:06:14.4010000
uptime -pup 6 minutes
So Mike moves the order page to the virtual machine for the weekend. Saturday, eight o'clock, Trish opens the tablet, and Mike's Flowers is there, ready for the first order.

Which one to pick
So which one should you use? Use WSL when Linux is a tool for you: the shell, Git, Python, right next to your Windows apps. Just keep your files on the Linux side. Use a virtual machine when Linux serves other people: it has its own address, it starts with the PC, and you can snapshot it and roll it back. Mike keeps both: WSL to write the page, the virtual machine to serve it.

Recap
Both start in seconds, and both run on Hyper-V. WSL is the workbench: fast for your own files on the Linux side, but only while someone is signed in. The virtual machine is the second shop: its own address, and open even when nobody is.

If this saved you an evening of guessing, subscribing brings the next comparison, tested on a real PC.
Every number in this video came from one real Windows PC, and the lab files are linked in the description. Thanks for watching Cloud Explainers.
Sources
- Microsoft, What is the Windows Subsystem for Linux? (WSL 2 runs a real Linux kernel in a lightweight utility VM)
- Microsoft, Working across file systems (store files in the WSL file system for the fastest performance)
- Microsoft, Accessing network applications with WSL (WSL 2 has its own IP address; netsh interface portproxy)
- Microsoft, Advanced settings configuration in WSL (memory: 50% of total memory on Windows by default)
- Microsoft, Set-VM (AutomaticStartAction)
Demos: one Windows PC in our own lab running WSL and a Hyper-V virtual machine, and a second machine standing in for the shop's tablet; the shop and its people are made up. Every command and line of output was real. Watch the full video on YouTube.