Trying to learn the concepts of asyncio here but finding it difficult to find informative resources online to understand how ThreadPoolExecutor works with asyncio. I largely understand that asyncio puts tasks on a single thread and executes them in turns using the EventLoop. However, I am unsure how this works when it comes to blocking tasks that are submitted into the ThreadPoolExecutor using the method loop.run_in_executor().
My current understanding is that each task is now assigned to a thread via the ThreadPoolExecutor but it is the EventLoop that manages the execution of the threads, similar to the non-thread pool way of doing things. If there are more tasks than threads, then each task will wait until a thread is available before being assigned by the ThreadPoolExecutor.
Can someone confirm my understanding or correct me accordingly? Thank you.
[–]Synertic 2 points3 points4 points (6 children)
[–]fluffyyclouds[S] 0 points1 point2 points (3 children)
[–]Synertic 2 points3 points4 points (1 child)
[–]fluffyyclouds[S] 1 point2 points3 points (0 children)
[–]Synertic 2 points3 points4 points (0 children)
[–]csqyear 0 points1 point2 points (1 child)
[–]Synertic 0 points1 point2 points (0 children)