How can I start a sub-process in Windows?

2019-02-17 08:21发布

问题:

In POSIX, there is the fork() function to create a sub-process. How can I achieve fork()'s functionality in Windows?

回答1:

There is no direct equivalent of fork() on Windows.

CreateProcess() is the native function that can be used to create a new process (but, again, the semantics are rather different to fork()'s).

To put this another way, on Unix it is possible for a process to cheaply create a clone of itself. There is no inexpensive way to do this on Windows.

If you don't care about the cloning aspect of fork(), then CreateProcess() should do just fine.



标签: windows fork