logoalt Hacker News

okanatyesterday at 10:56 PM1 replyview on HN

WSL1 DOES implement fork() for WSL1 lightweight processes in the lxcore.sys driver: https://learn.microsoft.com/en-gb/archive/blogs/wsl/windows-...


Replies

0x1d7today at 12:46 AM

The NT kernel does not understand fork(). You can-sorta-fake-it, which is what WSL1 did. There's no equivalent to fork() in any version of Windows. From your link:

> As an example, the Linux fork() syscall has no direct equivalent call documented for Windows. When a fork system call is made to the Windows Subsystem for Linux, lxcore.sys does some of the initial work to prepare for copying the process. It then calls internal Windows NT kernel APIs to create the process with the correct semantics, and completes copying additional data for the new process.

The MSFT driver prepped something-like-fork and then called the native NtCreateProcess, which does not implement anything like fork().