0

here is my code which is not working in windows.what should i use in place of fork

import os

print("Process id before forking: {}".format(os.getpid()))

try:
    pid = os.fork()
except OSError:
    exit("Could not create a child process")

if pid == 0:
    print("In the child process that has the PID {}".format(os.getpid()))
    exit()

print("In the parent process after forking the child {}".format(pid))
finished = os.waitpid(0, 0)
print(finished)
Aran-Fey
  • 39,665
  • 11
  • 104
  • 149

1 Answers1

0

The python multiprocessing module is universal and may be useful for you. For further reading, check out this link.

Also, Cygwin recreated it, but I wouldn't recommend it simply because of how difficult it is to implement, however, if you wish to learn about it, here is the link.

SamrajM
  • 620
  • 5
  • 12
  • but it doesn't know anything about fork. The error in log says. pid = os.fork() AttributeError: module 'os' has no attribute 'fork' – Bilal Ahmad Jul 29 '18 at 14:53