Hi Readers,
Greetings!!
Today I am going to tell you about ‘asyncio’ which is library in python and mainly use to write single-threaded concurrent code.
asyncio is used as a foundation for multiple Python asynchronous frameworks that provide high-performance network and web-servers, database connection libraries, distributed task queues, etc
Main thing here is why should we go for asyncio instead of threading –
answer is – When you use asyncio, you decide when a piece of code take back control using await. On the other hand, by using threads, Python scheduler is responsible to handle this and a piece of code may lose control anytime. Hence, you have to use some locking mecanism to prevent anything bad to occur to shared memory.
Hope you will read more about it. 🙂
Keep reading for more knowledge like – coroutines and use of asyncio in coroutines.
Quick example –
Great! I like to share it with all my friends and hope they will also like this information.
LikeLiked by 1 person
Thanks Chandu, keep learning and keep spreading knowledge.
LikeLike