| 1 | # WSL Overview |
| 2 | |
| 3 | WSL is comprised of a set of executables, APIs and protocols. This page offers an overview of the different components, and how they're connected. |
| 4 | Click on any component to get more details. |
| 5 | |
| 6 | |
| 7 | ```mermaid |
| 8 | %%{ init: { |
| 9 | 'flowchart': { 'curve': 'stepBefore' }, |
| 10 | 'theme': 'neutral' |
| 11 | } |
| 12 | }%% |
| 13 | graph |
| 14 | subgraph Windows["<b><p style="font-size:30px">Windows</p></b>"] |
| 15 | C:\Windows\System32\wsl.exe["C:\Windows\System32\wsl.exe"]---|"CreateProcess()"|wsl.exe; |
| 16 | wsl.exe[<a href="wsl.exe">wsl.exe</a>]---|COM|wslservice.exe; |
| 17 | wslg.exe[<a href="wslg.exe">wslg.exe</a>]---|COM|wslservice.exe; |
| 18 | wslconfig.exe[<a href="wslconfig.exe">wslconfig.exe</a>]---|COM|wslservice.exe; |
| 19 | wslapi.dll[<a href="https://learn.microsoft.com/windows/win32/api/wslapi/">wslapi.dll</a>]---|COM|wslservice.exe; |
| 20 | id[debian.exe, ubuntu.exe, ]---|"LoadLibrary()"|wslapi.dll; |
| 21 | wslservice.exe[<a href="wslservice.exe">wslservice.exe</a>]---|"CreateProcessAsUser()"|wslrelay.exe[<a href="wslrelay.exe">wslrelay.exe</a>]; |
| 22 | wslservice.exe---|"CreateProcessAsUser()"|wslhost.exe[<a href="wslhost.exe">wslhost.exe</a>]; |
| 23 | fs["Windows filesystem (//wsl.localhost)"] |
| 24 | end |
| 25 | |
| 26 | wslservice.exe -----|hvsocket| mini_init |
| 27 | wslservice.exe -----|hvsocket| gns |
| 28 | fs---|hvsocket|plan9 |
| 29 | |
| 30 | wsl.exe---|hvsocket|relay |
| 31 | |
| 32 | subgraph Linux["<b><p style="font-size:30px">Linux</p></b>"] |
| 33 | mini_init[<a href="mini_init">mini_init</a>]---|"exec()"|gns[<a href="gns">gns</a>] |
| 34 | mini_init---|"exec()"|init[<a href="init">init</a>]; |
| 35 | mini_init---|"exec()"|localhost[<a href="localhost">localhost</a>]; |
| 36 | |
| 37 | subgraph "Linux Distribution"["<b><p style="font-size:23px">Linux Distribution</p></b>"] |
| 38 | |
| 39 | init[<a href="init">init</a>]---|"exec()"|plan9[<a href="plan9">plan9</a>]; |
| 40 | init---|"exec()"|sid[session leader]; |
| 41 | sid[<a href="session-leader">session leader</a>]---|"exec()"|relay |
| 42 | relay[<a href="relay">relay</a>]---|"exec()"|cid["User command (bash, curl)"] |
| 43 | end |
| 44 | |
| 45 | end |
| 46 | ``` |