摘要: 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 =... 阅读全文
posted @ 2018-04-23 23:01 Erick-LONG 阅读(142) 评论(0) 推荐(0) 编辑
摘要: # import os # #fork只能用于linux/unix中 # pid = os.fork() # print("bobby") # if pid == 0: # print('子进程 {} ,父进程是: {}.' .format(os.getpid(), os.getppid())) # else: # print('我是父进程:{}.'.format(pid)) imp... 阅读全文
posted @ 2018-04-23 22:49 Erick-LONG 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 多进程 阅读全文
posted @ 2018-04-23 16:29 Erick-LONG 阅读(398) 评论(0) 推荐(0) 编辑
摘要: 线程间通信 -Queue 线程锁,lock和Rlock 条件变量-线程间同步 Semaphore 是用于控制进入数量的锁 阅读全文
posted @ 2018-04-23 08:00 Erick-LONG 阅读(280) 评论(0) 推荐(0) 编辑
摘要: #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... 阅读全文
posted @ 2018-04-23 06:51 Erick-LONG 阅读(115) 评论(0) 推荐(0) 编辑