> For the complete documentation index, see [llms.txt](https://til.kurianbenoy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.kurianbenoy.com/async-await/lesson-2-eventloops.md).

# Lesson 2- Eventloops

* call\_soon
* call\_later
* run\_forever - loops

![](/files/-MiNNXmw1pz0i3CapTrm)

Select operations

Eventloops can run only one things at a time. There is usually a :

selector or proactor

Reactors - reacts based on notifications used by reactors

twisted calls eventloops

I/0 completion Ports - changes. In windows you can use proactors and selctors. In Unix you can use selectors

![](/files/-Mj2KnVUeZHGAV5w1iF-)

Base\_events - consists of base events, yet there is only while loops there

![](/files/-Mj2N7F1aFQXjBgOKSY-)

Python 3.5 implementation, then in \`*run*once\`

![](/files/-Mj2NMmhvUXVvkd4_HTm)

Heart of heart of asyncio is select\_once method which calls the proactors and is having selector.select(timeout) method

![](/files/-Mj2O9k_kzQoIArmTQs9)

![](/files/-Mj2OKkm6F5F_wc8n3kL)

![](/files/-Mj2OLiTA_ZjKkwfQjmo)

Uvloop for production, as it's doing a lot of magic and improvement in results. As it's fastest implementation with similar performance to NodeJS

Eventloop is just a normal function for handling netoworks requests and is used to handle callbacks. By what?

![](/files/-Mj2Pledle4i1Vyi9898)

Eventloop is not magical, it's just a loop which handles network events and executes as callbacks one by one. It can handle many networks events concurrently with a selector or a proactor. While it can handle many callback, but only run one callback at a time. Some callbacks, run and come again with a trick called traumpaline

callsoon, calllater is difficult to run. But it's usually run using coroutine. These coroutines make asynchrnous programs easy and magical
