Home » Linux » Synchronous IO and asynchronous IO

Synchronous IO and asynchronous IO

reference article: http://blog.chinaunix.net/uid-28458801-id-4464639.html

today, the interview was asked this question, before reading to see, but the book is not clear enough, and did not remember, so this time carefully checked the information, in this record, remember it,.

first, we need to know one thing that when you perform the read operation, you go through 2 stages:

1. waiting for data to prepare

2. copies data from the kernel into the process,

is actually a ready event, blocking and non blocking IO IO should be very familiar with, the difference between them lies in the first step, non blocking IO does not block the first step, but the second step still blocked. Therefore, blocking IO, non blocking IO, IO multiplexing (select/poll/epoll) is synchronous (IO the concept of these here is not described above, the detailed explanation of.
What is
asynchronous IO, that is, the above 2 steps are all left to the kernel to complete, and then the kernel is finally notified of a completion event, which is really nonblocking, and that's the difference between the 2.

to sum up, is actually a synchronous IO received the ready event (first step), asynchronous IO received the complete event (second steps). At present, I contacted IO are synchronous IO model, so I come into contact with the asynchronous IO model after I will record.