0

How does my Windows computer that is running WSL2 know which OS kernel (Windows or Linux) to execute a program with? I know that WSL2 is essentially a lightweight VM but idk how to leverage this knowledge. I thought it might depend on whether or not the program was inside the WSL2 directory but when I moved a Windows executable (explorer.exe) into my WSL2's /home/username directory and executed it, it ran fine and opened File Explorer normally. Is it something about the executable file that lets the computer know which OS kernel (Windows or Linux) to run it with?

I am asking this because I'm wondering if it's ok to keep and work with Linux executables in my Windows directory ("/mnt/c/Users/myname/node projects").

Jason V
  • 51
  • 3
  • Read [a good textbook on operating systems](https://pages.cs.wisc.edu/~remzi/OSTEP/) and wikipage about [executable](https://en.wikipedia.org/wiki/Executable)s. See also [syscalls(2)](https://man7.org/linux/man-pages/man2/syscalls.2.html) – Basile Starynkevitch Feb 12 '21 at 20:01
  • Windows and Linux executable files use completely different formats (PE versus ELF), so the system can easily tell which is which, regardless of where they are located. – Nate Eldredge Feb 12 '21 at 21:58

0 Answers0