复制内容到剪贴板
代码:
[color=blue]-(guest@mac:tty1)-(python)-
[5894 0] %[/color] cat fork.py
#! /usr/bin/python
import os
pid = os.fork()
if pid != 0:
print "From parent: PID = %d" % (os.getpid())
os.wait()
else:
print " From child: PID = %d PPID = %d" % (os.getpid(), os.getppid())
[color=blue]-(guest@mac:tty1)-(python)-
[5894 0] %[/color] ./fork.py
From child: PID = 30091 PPID = [color=red]30090[/color]
From parent: PID = [color=red]30090[/color]
[color=blue]-(guest@mac:tty1)-(python)-
[5894 0] %[/color]