Explain what is asynchronous non-blocking?

In the IO and network programming, we often see a few concepts: synchronous, asynchronous, blocking, non-blocking.

Synchronous and asynchronous

  Synchronous and asynchronous interaction is for applications and kernel in terms of synchronization refers to the user process triggered IO operations and wait to see whether or polling IO ready for operation, but asynchronous refers to the user process is triggered after the operation began doing IO their own thing, and when IO operation has been completed will be notified IO completion.

Blocking and non-blocking

  Blocking and non-blocking processes are different ways to access data at the time, according to the state of readiness to take the IO operation, saying that white is a read or write implementation of the method of operation, a read or write at blocking mode function will wait the non-blocking mode, read or write method returns a status value immediately.

 

Way of understanding

  At first glance, these four concepts explanation will instantly feel the big head, also often speak synchronous asynchronous equivalent to blocking non-blocking, in fact, the distinction between them is very simple.

  The main difference between synchronous and asynchronous non-blocking is blocking for different objects.

 

  Synchronous Asynchronous is for the caller after it, the caller initiates a request has been dry and other feedback callee is synchronized, not have to wait to do something else that is asynchronous.

  For non-blocking is blocking the caller is, the callee after receiving a request, done after the request is blocked task given feedback received requests directly give feedback and then do the task is non-blocking.

 

Bus at the bus station

  The caller - passengers:

  1, has been looking at the direction of the bus to dry, is synchronized.

  2, not looking at the direction the bus came, pulled out a laptop to change the bug, whether listening to the car radio bus station is asynchronous.

  Those with passive - in terms of public transport system:

  1, bus station broadcast is non-blocking.

  2, the bus station is not broadcasting is blocked.

Guess you like

Origin www.cnblogs.com/Rivend/p/12065474.html