All functions in the os module raise OSError for invalid or unreachable file names and paths or other arguments that are of the correct type but are not accepted by the operating system.
os.fork () in Python is used to create a child process. This method works by calling the base OS function fork () . This method returns 0 in the child process and the child process ID in the parent process.
os.fork () em> only available on UNIX platforms.
Syntax: os.fork ()
Parameter: No parameter is required
Return Type: This method returns an integer value representing child`s process id in the parent process while 0 in the child process.
Code: using the os.fork () method to create a child process p >
< / p>
I am Parent process Process ID: 10793 Child`s process ID: 10794 I am child process Process ID: 10794 Parent`s process ID: 10793