+ 1

Python: Tasks vs Threading (asyncio)

Hi, I have read that the async and await keywords in collaboration with the asyncio module are not used to create a separate thread from the main one, but to create one or more tasks that can run simultaneously. What I don't understand is how does it do this if it doesn't use separate threads? Would anyone know how to answer?

23rd Feb 2022, 8:33 PM
Mick
Mick - avatar
1 Odpowiedź
+ 4
High level languages sometimes implement custom threadlikes in userspace. For example NodeJS has a built-in ticking engine that schedules which command will be executed next, like a fake CPU.
23rd Feb 2022, 10:49 PM
Valen.H. ~
Valen.H. ~ - avatar