Synchronous and asynchronous blocking and non-blocking

Source: Internet
Author: User

1.1 Events used in life:I want to go to the bank to save money business, because there are many people, need to wait in line. 1) queuing is divided into the queue to wait and take the number of waiting two. Waiting in the team, then I need to constantly see the people in front of the finished. If you choose to wait for the number, then I am more comfortable, I do not have to control whether the person in front of the process, I just need to wait for others to notify me. That is, the two ways, one is to do, one is to do others.          The two are superior to the other, at a glance. 2) Of course, in the process of queuing, we sometimes call to send text messages to read and so on to kill time. Then if it is waiting in the queue, I call to send text messages to read the action, then I have to look at the front of the person whether to complete, but also to call to send text messages and read the action, it is laborious ah. And if I choose to take the number to wait, then I sit on the sofa, call to send text messages to read, the heart of a use, cool. 1.2 problems with the corresponding technology:The Queueing method I chose corresponds to synchronous and asynchronous.          Waiting in the queue is synchronous, the number waiting is asynchronous. I am in the process of waiting, be able to call to send text messages read the action, is non-blocking. If in the waiting process, can not make a call to send text messages to read the action, it is blocking. 1.3 Summary:Synchronization and Asynchrony are just mechanisms for how the message is notified, not the mechanism for handling the message. That is, in the case of synchronization, it is up to the processing message to wait for the message to be triggered, and the trigger mechanism to notify the person who handled the message in the asynchronous case. 2. Synchronous, asynchronous, blocking, non-blocking understanding 2.1 Synchronous blocking I/OOfficial explanation: When a user-space application executes a system call, it causes the application to block.     The user control's application will continue to execute only if the system call ends (data transfer is complete or an error occurs). My understanding: When I went to the bank to save money, I had to wait in line in the queue, and in the process of waiting I can not do anything, can only wait. How dreary. 2.2 Synchronous non-blocking I/OOfficial explanation: I understand: when I go to the bank to save money, I have to wait in line, but I am waiting for the process I will call to read. I have to look at the front of the people whether the end of the business, but also to call a book, too tired. Program Ape Bitter Force, queue to do business also have to double-use. 2.3 Asynchronous blocking I/OOfficial explanation: Another blocking solution is non-blocking I/O with blocking notifications. In this model, a non-blocking I/O is configured, and then a blocking select system call is used to determine when an I/O descriptor is operational. The interesting thing about making a select call is that it can be used to provide notifications for multiple descriptors, not just a single descriptor. For each prompt, we can request that the descriptor can write data, have read data available, and notify if there is an error. (Difficult to understand) my understanding: I go to the bank to save money, I take the number waiting, I wait for someone to notify me to handle business, but in the process of waiting, I can not do anything, can only wait. It's hard to think about what you can't do in the process of waiting. 2.4 Asynchronous non-blocking I/O (AIO)Official explanation: The asynchronous nonblocking I/O model is a model that handles I/O overlap. The read request returns immediately stating that the read request has been successfully initiated. When the read operation is completed in the background, the application then performs other processing operations.     When the response of read arrives, a signal is generated or a thread-based callback function is executed to complete the I/O process. My understanding: When I go to the bank to save money, take the number waiting, I can look at the book to call, waiting for others to inform me. 3. SummarySynchronous vs. Async is a set of relative concepts for whether you are waiting for yourself or others to inform you that blocking and non-blocking are a set of relative concepts that are targeted to the actions of the waiting person during the wait process. Transferred from: http://blog.csdn.net/yankai0219/article/details/8018232

Synchronous and asynchronous blocking and non-blocking

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.