摘要:
import time from multiprocessing import Process, Queue, Pool, Manager, Pipe # def producer(queue): # queue.put("a") # time.sleep(2) # # def consumer(queue): # time.sleep(2) # data =... 阅读全文
摘要:
# import os # #fork只能用于linux/unix中 # pid = os.fork() # print("bobby") # if pid == 0: # print('子进程 {} ,父进程是: {}.' .format(os.getpid(), os.getppid())) # else: # print('我是父进程:{}.'.format(pid)) imp... 阅读全文
摘要:
多进程 阅读全文
摘要:
线程间通信 -Queue 线程锁,lock和Rlock 条件变量-线程间同步 Semaphore 是用于控制进入数量的锁 阅读全文
摘要:
#500G, 特殊 一行 def myreadlines(f, newline): buf = "" while True: while newline in buf: pos = buf.index(newline) yield buf[:pos] buf = buf[pos + len(newline):] chunk = f.re... 阅读全文