请教一个关于 asyncio 的问题 #2198
Unanswered
sleepwalker2017
asked this question in
Q&A
Replies: 2 comments 1 reply
-
我的理解是这个 task 应该是会放入 loop 中由 Python 自己去调度。asyncio 协程只能够优化 I/O 等待的时间,如果 CPU 一直处于使用状态的话,是不能够执行其他 task 的,因为线程只有一个。 |
Beta Was this translation helpful? Give feedback.
1 reply
-
https://jacobpadilla.com/articles/recreating-asyncio An explanation. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
大佬们,初学 async io,有个问题没搜到答案,请教下。
我在await task之后,这个 task 是会立即执行,还是会放入 loop 重新排队?
如果这个 task 耗时比较长,而且中间也没有让出 CPU,我自己做的实验发现, loop 会等这个 task 执行完,才调度其他的 task。
有人读过相关的文档吗?这块的语义看起来很模糊。
感谢!
Beta Was this translation helpful? Give feedback.
All reactions