import os
def parent(pid_par):
print('Parent process PID: ', pid_par)
def child(pid_ch):
print('Child process PID: ', pid_ch)
def main():
rs = os.fork()
if rs > 0:
parent(os.getpid())
if rs == 0:
child(os.getpid())
if _name_ == '_main_':
main()
Comments
Leave a comment