# L-33 MCS 275 Mon 5 Apr 2010 : fork.py import os def child(): print 'hello from child', os.getpid() os._exit(0) # go back to parent loop def parent(): while True: newpid = os.fork() if newpid == 0: child() else: print 'hello from parent',\ os.getpid(), newpid if raw_input() == 'q': break parent()