This is a follow up question to this question:
If async-await doesn't create any additional threads, then how does it make applications responsive?
and to this blog post:
http://blog.stephencleary.com/2013/11/there-is-no-thread.html
Regarding the accepted answer of the linked question.. He describes steps of what happens when await
is called.
He writes there on step 3 and 4 that when that happens, the current thread returns to the calling context which makes the message loop available to receiving additional messages which makes the application responsive. And then in step 5 he writes that the task which we called await on is now complete and the rest of the original method continues after receiving a new message to continue the rest of the method.
What I didn't understand there is how exactly that task was executed to begin with if there wasn't a new thread, and the original thread is busy with the calling context?
So I turned to the blog post, which describes how the entire operation is actually done in much lower levels (which honestly I don't really know how they work) and then there is simply a notification that it was done... But I don't understand why suddenly in the case of the task, you can rely on other hardware for your calculations instead of the CPU which somehow makes it possible not to create a new thread.. And what if this task is some complicated calculations, then won't we need the CPU? And then we return to what I was writing that the current thread is already busy with the calling context...