Synchronous Asynchronous

https://blog.csdn.net/huangqiang1363/article/details/79508852

To be honest, playing computer also played for several years; see how many times the impression that "synchronous and asynchronous" keyword can not remember, always feel they know something, but could not say anything but, this is for What? - Because there is no in-depth understanding, not learned; also be a phrase an old saying: paper learned Zhongjue know this practice is essential. Do not sell off the child, and began to business.
"Sync" is like: you go to the field school (unfamiliar), suddenly the cost of living is not enough; this time you decide to call home to inform the family living expenses turn over, but when you make a call, the other party has to be answered in status (ie: can not get through, can not contact), in order to get the cost of living, you'll stop oncall, wait, eventually may not be in time to the cost of living, resulting in what you do today, things are not completed, but in vain spent time.
"Asynchronous" is this: when you got off the phone found no answer, guess: the other party may be busy, temporarily unable to answer the phone, so you send a text message (or voice mail, also, or other means) after notice to the other busy with other matters thing; then you do not need to constantly make phone calls, you can also do other things; after a certain time, the other party to see your message will respond to your reply, of course, the other party may or may not turn transferred the money money. But throughout the day, you do a lot of things. Or do you find a roommate temporarily borrow a sum of money, he began a happy time in school.
In short, words and short: synchronous what I strongly dependent on you (the other side), I have to wait for your reply, in order to make the next step in response. That is my operation (stroke) is executed sequentially, the middle less what step can not, or can not mistake an intermediate step which, similar to the programming program is executed sequentially as an interpreter; and if I do not receive you reply, I have been in a wait, which is blocked state. Asynchronous on the contrary, I rely on you not strong, I'm not sensitive to the time you respond, whether you return or not to return, I can continue to run; and return your response, I will continue to do things before, you do not in response, I'll do something else. That is my concept of waiting for the other party does not exist, I am non-blocking.
View from the above example: synchronization appears equivalent to the blocking, this is equivalent to an asynchronous non-blocking. In fact, some narrow, but it is undeniable that, under certain circumstances, we can really think so; because there must be synchronous blocking state, and asynchronous non-blocking certain state does not exist. But that is not a synchronous call == blocking calls it? However not; blocking and non-blocking emphasized that the state of the program while waiting for the result of the call (the message, the return value) refers to the blocking call before the call returns, the current thread is suspended. Only the calling thread does not return until after the result. Before non-blocking call refers not get the results immediately, the call does not block the current thread. For synchronous calls, many times the current thread is still active state, but from the logic of the current function does not return it, ie synchronization wait doing nothing, in vain occupy the resources. Synchronous and asynchronous communication mechanism to emphasize that message (synchronous communication / asynchronous communication). The so-called synchronous, that is, when you issue a "call", until no results, the "call" is not returned. But once the call returns, the return value is obtained. In other words, the "caller" active waiting for this "call" results. The induction is the opposite, "call" after issuing this call directly returned, so no results are returned. In other words, when an asynchronous procedure call is issued, the caller will not immediately get results. But after the "call" is issued, "the caller" to inform the caller through the state, notification, or to deal with this by calling the callback function. Paragraphs refer to the original link: HTTPS: //www.zhihu.com/question/19732473/answer/20851256
---------------------

 

 

 

 

I borrow money to buy a house like this, tell others about it, I will continue to work, others will return my messages, or messages are not, this I do not care, do is asynchronous notification messages to each other, then return and continue to do what other things. The synchronization is, I want you to ask me, you will answer me now, if you do not answer, I'll be waiting, keep asking, what is not done, simple to understand, synchronous and asynchronous it. I remember this station can go to b, say computer composition principle of the screen, and professor of Harbin say good things inside, it comes to this. Mr God teenager

 

Guess you like

Origin www.cnblogs.com/woainixxx/p/11106778.html