synchronous, asynchronous, blocking, non-blocking understanding __ Network Programming

Source: Internet
Author: User

Some people think that asynchrony is not blocking, and synchronization is blocking. This is because different people have different knowledge backgrounds, and the context is not the same when discussing this problem. So, to better answer this question, let me first limit the context of this article. The background discussed in this article is the network IO in the Linux environment.

The most important references in this article are Richard Stevens's "Unix®network programming Volume 1, third edition:the Sockets networking", section 6.2 "I/O Models", Stevens in this section details the various IO features and differences, if the English is good enough, recommend direct reading. Stevens's style is famous in simple and simple, so don't worry about not understand.

Stevens in the article compares five kinds of Io Model altogether:
Blocking IO
nonblocking IO
IO multiplexing
Signal Driven IO
Asynchronous IO
Since signal driven IO is not commonly used in practice, I'm only referring to the remaining four types of Io Model.

Give a few examples that are not very appropriate to illustrate these four IO Model:
There are a,b,c,d four men in the fishing:
A (blocking) with the most old-fashioned fishing rod, so, must be kept, wait until the fish hooked the pull lever;
B (non-blocking) fishing rod has a function, can show whether there is fish bait, so, B and next to the MM chat, and then see if there is no fish bait, and some words on the quick lever;
C (IO multiplexing) with a fishing rod and b almost, but he thought of a good way, is to put several fishing rods, and then guarding the side, once there is a show that the fish hooked, it will be the corresponding fishing rod pull up;

The

    A,b,c all belong to synchronous IO.
    D (asynchronous IO) is a rich man, simply hired a person to help him fishing, once the man catches the fish, he sent a message to D.

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.