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.