异步模块的说明如下:
This module provides infrastructure for writing single-threaded concurrent code using coroutines, multiplexing I/O access over sockets and other resources, running network clients and servers, and other related primitives.
我一直在阅读关于新的和非凡的asyncio python模块/包/whatever的文章。我知道有pythongil,因此asyncio非常适合GIL,因为(目的是)在单个线程上使用事件循环来管理事情。那么什么是并发的呢?看来I/O似乎是并发的。我相信I/O操作是由操作系统处理的。那么在asyncio的内部,它是否编写了一个利用操作系统提供的函数的并发C扩展呢?在
在asyncio中,单线程IO并发是通过组合许多概念来实现的:
然而,正如curio所证明的那样,在没有期货的情况下也有可能达到同样的目的:
^{pr2}$链接
Standard library:
Asyncio:
Curio:
相关问题 更多 >
编程相关推荐