Home > Net > C # for bosses to explain the asynchronous
C # for bosses to explain the asynchronous
Time:09-18
Dear bosses, or less busy work all right before he goes to bed at night, can you help me and explain the theory of asynchronous, what is the "future is complete," the difference between asynchronous and multi-threaded, why can't the asynchronous interpreted, the main thread execution to the asynchronous for asynchronous code block, open a thread to execute, implement after the return to the main thread, for bosses to explain, and the difference between best example code, I will be an instance a instance to knock again
CodePudding user response:
Then they understand that why in 15 years ago, you see the information back to appear so much sleep and so much information about the thread synchronization
Why do you want to sleep, why do you want to thread synchronization? Because we are not only do one thing, we need to do is, you have finished, do then behind
So in its struggle to distinguish, instance,
Might as well to consider, if you're going to do it with the traditional thread, how are you going to do this action do then? Obviously, either the while (true) sleep run polling check, or from another thread waits for synchronous semaphore release, or asynchronous delegate asynchronous notifications out
We're not considering what open a thread, we consider is then do the follow-up
CodePudding user response:
Many people like to use to cook it, speak to multi-threaded, parallel examples
Well, he cooked rice cooker in the back we said "drop ~ ~" singing, inform him ready, waiting for your further processing, For a thread does not always perform void, in most cases we are asked him to return to the state, that is you said "when he finished the state of the future"
CodePudding user response:
Multi-threading CPU is have a lot of questions to , but the performance is limited, couldn't get on the frequency, you of the code, such as the 100 title, decompose into 10 portions, each 10 questions, give 10 threads to execute, anyway, now the CPU while high frequency will not come up, core is still a lot of, this calculation is fast,
Asynchronous is CPU speed although couldn't get on, but what are the external interface or too fast, network access, disk, speaking, reading and writing, is slowly, if you need to take from the Internet computing when a data, if it is the same main thread in the execution, that at the time of waiting for the main thread card, such as software to display data on a network, the network card, your software will drag down did not move, but where is your CPU is idle die, then use asynchronous, met slow affair CPU to another thread to work, just finished tell me, I can, the so-called future is complete, when we were waiting for the return to do something else, just won't be the card interface,