examples/os/fork.py
from __future__ import print_function
import os,time

name = "common"

def child():
    print("In Child of {}".format(name))
    print("In Child PID: {} PPID: {}".format(os.getpid(), os.getppid()))

    time.sleep(5)
    exit(1)

def parent(child_pid):
    print("In Parent ({}) The child is: {}".format(name, child_pid))
    print("In Parent PID: {} PPID: {}".format(os.getpid(), os.getppid()))
    r = os.wait()
    print(r)

pid = os.fork()
if pid:
    parent(pid)
else:
    child()

$ python fork.py
In Parent (common) The child is: 31351
In Parent PID: 31350 PPID: 10025
In Child of common
In Child PID: 31351 PPID: 31350
(31351, 256)