Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

fork function in python

# Python code to create child process 
import os
  
def parent_child():
    n = os.fork()
  
    # n greater than 0  means parent process
    if n > 0:
        print("Parent process and id is : ", os.getpid())
  
    # n equals to 0 means child process
    else:
        print("Child process and id is : ", os.getpid())
          
# Driver code
parent_child()
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #fork #function #python
ADD COMMENT
Topic
Name
9+1 =