摘要: 示例1 import threading import time # 进程比较消耗资源 线程比较消耗cpu def func01(number): print("函数func01 start") time.sleep(2) print("函数func01 end") def func02(numbe 阅读全文
posted @ 2022-11-10 22:03 钟鼎山林 阅读(156) 评论(0) 推荐(0)
摘要: IO 密集型应用 IO 密集型应用CPU等待IO时间远大于CPU 自身运行时间,太浪费;常见的 IO 密集型业务包括:浏览器交互、磁盘请求、网络爬虫、数据库请求等 Python 世界对于 IO 密集型场景的并发提升有 3 种方法:多进程、多线程、异步 IO(asyncio);理论上讲asyncio是 阅读全文
posted @ 2022-11-10 09:47 钟鼎山林 阅读(113) 评论(0) 推荐(0)