摘要: def get_html(n): time.sleep(n) print("sub_progress success") return n # 多进程池 pool = multiprocessing.Pool(multiprocessing.cpu_count()) result = pool.apply_async(get_html, args=(3,)) # 类... 阅读全文
posted @ 2019-07-08 22:37 下路派出所 阅读(314) 评论(0) 推荐(0) 编辑
摘要: 1. 对于耗费CPU的操作来说,多进程优于多线程 2. 对于耗费IO操作来说,多线程优于多进程 3. 多进程切换代价大于多线程 4. 协程适用于:密集网络IO,适合网络IO 阅读全文
posted @ 2019-07-08 22:15 下路派出所 阅读(354) 评论(0) 推荐(0) 编辑