2007年01月11日 星期四 09:35
!/usr/bin/python import os import sys import time try: forkPID = os.fork() except OSError: os.exit("Unable to creat child process") if forkPID != 0: print "Parent process executing" elif forkPID == 0: print "child process executing" ÉÏÃæ³ÌÐòÖеÄforkPID²»¾ÍÊÇos.forkµÄ·µ»ØÖµÂ𣿠ËüÓ¦¸ÃÖ»ÊÇÒ»¸öÖµ£¬»òÕßÊÇ0£¬»òÕß·Ç0, Ò²¾ÍÊÇ˵ÉÏÃæµÄ³ÌÐò£¬Ö»ÄÜÓÐÒ»ÐÐÊä³ö¡£ µ«ÊÇ£¬ÔËÐÐÖ®ºó£¬È´×ÜÄÜ¿´µ½Á½ÐÐÊä³ö¡£²»ÖªµÀÊÇΪʲô¡£ os.fork()´´½¨µÄ×Ó½ø³Ì»á¡¡ print "child process executing" ¸¸½ø³Ì»á print "Parent process executing" ¡¡¡¡¡¡¡¡¡¡¡¡¡¡Ö Àñ£¡ ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Jin Qing ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡jinq0123在163.com ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2007-01-11 -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20070111/8046a422/attachment.htm
Zeuux © 2025
京ICP备05028076号