Python 进程与多线程

10 进程和多线程

      10.1 多进程

                  

# -*- coding: utf-8 -*-

import os

pid=os.fork()

print ('process (%s)start ...' %os.getpid())

if pid==0:

         print('I am child process (%s) and my parent is %s.' % (os.getpid(), os.getppid()))

else:

        print('I (%s) just created a child process (%s).' % (os.getpid(), pid))

转载于:https://www.cnblogs.com/smartwen666/p/7911357.html

你可能感兴趣的:(python)