第1个回答 2013-10-20
#!/bin/python
import os
import time
def my_fork():
child_pid =os.fork()
while 1==1:
if child_pid ==0 :
print "c \n "
# print "child process :PID # %s" % os.getpid()
# time.sleep(3)
else:
print "p \n"
# print "parent process: PID# %s" % os.getpid()
# time.sleep(3)
if __name__ == "__main__":
my_fork()