import os, sys, time
code = os.fork()
if code == 0:
    for j in range(5):
        time.sleep(1)
        print 'child still alive, process ID: ', os.getpid()
    # after 5 seconds, terminate the child
    sys.exit(1)
else:
    # don't let the parent wait
    for i in range(10):
        print 'parent still alive, process ID ', os.getpid()
        time.sleep(1)
