#!/usr/bin/env python
import os
def my_fork():
child_pid = os.fork()
if child_pid == 0:
print "Child Process: PID# %s" % os.getpid()
else:
print "Parent Process: PID# %s" % os.getpid()
if __name__ == "__main__":
my_fork()
首先这里是有两个进程在执行,父子关系,这样就好理解了,先有父才有子