Coroutines are similar to threads, but threads are provided by the bottom layer of the operating system, while coroutines are provided by the platform itself. Coroutines are based on threads. The bottom layer of a coroutine library is supported by operating system threads, and then the library completes task scheduling by itself without relying on system scheduling. The advantages of coroutines have been mentioned in the link you posted, but the disadvantage is that the implementation is more complicated, and the actual performance will be lower than using threads directly.
Coroutines are functions that are called in an infinite loop. The above is the basic idea of coroutines. There is nothing mysterious~ It needs to be used with asynchronous IO to avoid blocking~
The concept of coroutines is explained in detail in the link on the second floor. You can also learn about gevent. A coroutine based library. After understanding this, I believe you will have a better understanding of coroutines
Coroutines are similar to threads, but threads are provided by the bottom layer of the operating system, while coroutines are provided by the platform itself.
Coroutines are based on threads. The bottom layer of a coroutine library is supported by operating system threads, and then the library completes task scheduling by itself without relying on system scheduling.
The advantages of coroutines have been mentioned in the link you posted, but the disadvantage is that the implementation is more complicated, and the actual performance will be lower than using threads directly.
Coroutines are actually function calls, which are more lightweight than threads. For details, you can view coroutines
Coroutines are functions that are called in an infinite loop.
The above is the basic idea of coroutines. There is nothing mysterious~
It needs to be used with asynchronous IO to avoid blocking~
The concept of coroutines is explained in detail in the link on the second floor. You can also learn about gevent. A coroutine based library. After understanding this, I believe you will have a better understanding of coroutines