| 1 | # Wslhost.exe |
| 2 | |
| 3 | `wslhost.exe` is a Windows executable that's used to display desktop notifications, and run Linux processes in the background. |
| 4 | |
| 5 | ## COM server |
| 6 | |
| 7 | When running as COM server, `wslhost.exe` registers a [NotificationActivatorFactory](https://learn.microsoft.com/dotnet/api/microsoft.toolkit.uwp.notifications.notificationactivator?view=win-comm-toolkit-dotnet-7.1), which is then used to display desktop notifications to the user. |
| 8 | |
| 9 | Notifications can be used to: |
| 10 | |
| 11 | - Notify the user about a WSL update |
| 12 | - Warn the user about a configuration error |
| 13 | - Notify the user about a proxy change |
| 14 | |
| 15 | See: `src/windows/common/notifications.cpp` |
| 16 | |
| 17 | ## Background processes |
| 18 | |
| 19 | When [wsl.exe](wsl.exe.md) terminates before the associated Linux process terminates, `wslhost.exe` takes over the lifetime of the Linux process. |
| 20 | |
| 21 | This allows Linux processes to keep running Windows commands and access the terminal even after the associated `wsl.exe` terminates. |
| 22 | |
| 23 | See `src/windows/wslhost/main.cpp` and [interop](interop.md) |