[] Tcp TCP protocol communications io

Blocking IO

the recv, received data, if not, will be blocked,

When the other party to send data, linux kernel buffer to obtain data,

Copy the kernel data to recv () calls where the user space,

Unblocking, for further processing,

Non-blocking IO

Polling calls recv function to receive data,

No data is returned immediately, and continue to call,

The return value to determine when to read data,

This large consumption of the CPU, a small range of applications, and is generally used with reusable selectIO,

IO multiplexing

select mechanism, fd may poll a plurality of state change,

Recv then decide whether to read the data, but will not like the two extremes above,

But more fd polled did not change state, it will also be blocked,

At the same time select the wait time may be provided, to avoid jerky,

IO drive signal

Establishing a signal, when the data arrives, informing the upper application to read data,

This model with less signal transmission delay, processing delay data, core data may vary,

  Why drive signal delay much?

  Because the data to obtain a transmission signal to inform the upper application,

  After the notification, not necessarily immediately to read,

  Have the opportunity to read, and had to run over to read

Asynchronous IO

Asynchronous IO, the upper application provides a buffer application layer,

There are data, the kernel will take the initiative ,, stuffed into the buffer of the data provided by the application layer, rather than the process so as to have the initiative to read as above, but this complex process you temporarily can not understand it in depth, but you can sure, sure initiative involves a lot of reading during the processing,

Guess you like

Origin www.cnblogs.com/itplay/p/11375441.html