2018年10月23日

摘要: import multiprocessingimport os, time, randomdef Lee(): print("\nRun task Lee-%s" %(os.getpid()) ) #os.getpid()获取当前的进程的ID start = time.time() time.sle 阅读全文
posted @ 2018-10-23 15:29 happygril3 阅读(84) 评论(0) 推荐(0)
摘要: from multiprocessing import Poolimport os,timeimport multiprocessingdef func(msg): print("msg:", msg) time.sleep(3) print("end") return "done" + msg#使 阅读全文
posted @ 2018-10-23 15:27 happygril3 阅读(174) 评论(0) 推荐(0)
摘要: import multiprocessingimport time#方式一def worker(interval): n = 5 while n > 0: print("The time is {0}".format(time.ctime())) time.sleep(interval) n -= 阅读全文
posted @ 2018-10-23 15:26 happygril3 阅读(113) 评论(0) 推荐(0)
摘要: multiprocess: multiprocess.cpu_count():统计cpu核数 multiprocess.active_chirdren():获取所有的子进程 multiprocess.current_process():获取当前的子进程 multiprocess.Prpcess(ta 阅读全文
posted @ 2018-10-23 15:24 happygril3 阅读(260) 评论(0) 推荐(0)

导航