mirror of
https://github.com/microsoft/WSL.git
synced 2025-07-03 23:33:21 +00:00

Many Microsoft employees have contributed to the Windows Subsystem for Linux, this commit is the result of their work since 2016. The entire history of the Windows Subsystem for Linux can't be shared here, but here's an overview of WSL's history after it moved to it own repository in 2021: Number of commits on the main branch: 2930 Number of contributors: 31 Head over https://github.com/microsoft/WSL/releases for a more detailed history of the features added to WSL since 2021.
925 B
925 B
Relay
Relay is a WSL2 linux process creating by a session leader. Its job is to create a linux process on behalf of the user, and relay its output back to Windows.
Creating a user process
A relay is created when a LxInitMessageCreateProcessUtilityVm
message is sent to a session leader. Once created, the relay
creates multiple hvsocket
channels with wslservice.exe.
These channels are used to:
- Relay standard file descriptors (stdin, stdout, stderr)
- Relay information about the terminal (for instance when the terminal window is resized from Windows)
- Notify Windows when the linux process exits
Once those channels are configured, the relay
forks() into two processes:
- The parent, which will read & write to the child's standard file descriptors and relay it to Windows
- The child, which calls
exec()
and starts the user process