Map WSL process ID to Windows process ID
Currently there appears no clean way to get the corresponding Windows process ID of a running WSL process. I can inspect the PIDs of running processes in Windows taskmanager or with the tasklist command from bash on WSL as in:
oeffner@grove:~$ cmd.exe /c tasklist
But that does not guarantee unambiguous identification PIDs if more processes have the same name.
It would be great if the PID of a WSL process was available as an additional column for Windows TaskManager and the tasklist command.
It would also be great if it were possible under WSL to get the corresponding Windows PID of a running WSL process.
Erkin Alp Güney commented
They should have been equal.
Robert Oeffner commented
On a related note, WSL does not seem able to properly control win32 binaries that have been started from WSL. If notepad is started under WSL and then later killed from WSL that still leaves notepad running. This complicates writing bash scripts interacting both with Linux and with win32 binaries; the result of checking for a running win32 process with say the Linux "pidof" command cannot be trusted.