In POSIX, there is the fork() function to create a sub-process. How can I achieve fork()‘s functionality in Windows?
In POSIX, there is the fork() function to create a sub-process. How can I
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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 tofork()‘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(), thenCreateProcess()should do just fine.