Asynchronism can be obtained through a state machine since it only needs to ensure that there is no waiting while doing something potentially time-consuming, so it needs to switch the execution context between more than a part of the application.
This is an old and well-known technique used in various problems. It changes one or more certain states according to what is happening in something related to what it is controlling.
Even this mechanism has several ways to implement it. The way the input that causes state change can be obtained in several ways. An event system that indicates the change of state is very common.
The image there in the question is very illustrative how complicated it is to control the flow of execution. Follow the Indian War.
Wikipedia article .
A C # implementation .
Detailed explanation of how C # async/await
works . There are more or less examples of how the code actually looks when this mechanism is used. Everything there is a state machine, and what is waiting is responsible for changing the state of that machine. When there is no more waiting a different processing is executed closing what started, but does not block the execution of other things. There is a control if you can still do something else, or if you should resume processing what is on hold.
An actual code example that is generated by the compiler . Simple, is not it?
I'm still going to get better.