in the book ,A call to wait() suspends execution (i.e., waits) until a child 
process (any child process) has completed, terminating either normally or via a 
signal. wait() will then reap the child, releasing any resources. If the child 
has already completed, then wait() just performs the reaping procedure. 
here  is my code 
import os
print "i am parent ",os.getpid()
ret  =  os.fork()
print  "i am here",os.getpid()
if  ret  ==  0:
         os.system('ls')
else:
        os.wait()
print "i am runing,who am i? ",os.getpid()

according to the word,the output may be:
i am parent  8014
i am here 8014
i am here 8015
"omitted my file"
i am runing,who am i?  8014
because 8015  is terminated by os.wait().

in fact the output is:

i am parent  8014
i am here 8014
i am here 8015
"omitted my file"
i am runing,who am i?  8015
i am runing,who am i?  8014

i want to know why ??
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to