asyncio的哪个部分是并发的?想要实现细节。

2024-05-19 13:25:14 发布

您现在位置:Python中文网/ 问答频道 /正文

异步模块的说明如下:

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扩展呢?在


Tags: 模块andasyncioforcodethisthreadedconcurrent