import osimport psycopg2from multiprocessing import Processdef target(args): # Each forked process will have its own connection # http://initd.org/psycopg/docs/usage.html#thread-and-process-safety conn = get_db_connection() # Stuff seems to execute till this point in all the children print os.getpid(), os.getppid() # Do some updates here. After this only one child is active and running # Others become Zombies after a while.if __name__ == '__main__': args = "Foo" for i in xrange(3): p = Process(target=target, args=args) p.start()