What's the best way to duplicate fork() in windows? What's the best way to duplicate fork() in windows? python python

What's the best way to duplicate fork() in windows?


Use the python multiprocessing module which will work everywhere.

Here is a IBM developerWords article that shows how to convert from os.fork() to the multiprocessing module.


fork() has in fact been duplicated in Windows, under Cygwin, but it's pretty hairy.

The fork call in Cygwin is particularly interesting because it does not map well on top of the Win32 API. This makes it very difficult to implement correctly.

See the The Cygwin User's Guide for a description of this hack.


Have a look at the process management functions in the os module. There are function for starting new processes in many different ways, both synchronously and asynchronously.

I should note also that Windows doesn't provide functionality that is exactly like fork() on other systems. To do multiprocessing on Windows, you will need to use the threading module.