IO (input / output)
In computers, input / output (i.e. IO) refers to the communication between information processing systems (such as computers) and the external world (which can be people or other information processing systems). Input refers to the signal or data received by the system, and output refers to the data or signal sent from the system. Since the program and runtime data reside in memory and are executed by the CPU, an ultra fast computing core, IO will be generated where data exchange is involved, usually disk, network, etc.
Synchronization and asynchrony is a message communication mechanism (synchronous communication / asynchronous communication), and the focus is
Callee return and
Result return The relationship between the description object and the behavior of the called object.
#Synchronous: when a synchronous call is issued, the call will not return until the result is obtained. The subsequent operations will not continue until the result is returned. #Asynchronous: make a call and return directly, regardless of whether the result is returned. Asynchrony can notify the caller of the results through status, callback and notification. You can perform other operations first, then wait for the notification, and then come back to perform the operations that have not been performed just now.
Blocking non blocking
Blocking and non blocking are business process processing methods. The focus is on when the call occurs
Caller status and
Result returned by callee Relationship between. It describes the state of the caller when waiting for the result. At this time, the result may be returned synchronously or asynchronously.
#Blocking: the current thread is suspended before the result is returned, and subsequent code can be executed only after the result is returned. #Nonblocking: the call will not block the current thread until the result cannot be obtained immediately.
Synchronous blocking – synchronous non blocking
In actual programming, the synchronous non blocking of processes is realized through threads, and the synchronous non blocking of threads is realized through coprocesses.
#Synchronization blocking: call the boss and ask if there is a Book (call). The boss said to check and let you hang up (synchronization). You have been waiting for the boss to give you the results and do nothing (blocking). #Synchronous non blocking: call the boss and ask if he has a Book (call). The boss said to check and let you hold the phone (synchronization). You are still eating melon seeds (non blocking) while waiting for the phone.
Asynchronous blocking – asynchronous non blocking
#Asynchronous blocking: call the boss to ask if there is a Book (call). The boss says you hang up first and notify you of the result (asynchronous). After you hang up (end the call), you don’t do anything except wait for the boss to notify the result (blocking).
#Asynchronous non blocking: call the boss and ask if there is a Book (call). The boss says you hang up first and notify you of the result (asynchronous). After you hang up (end the call), wait for the phone and eat melon seeds again and again（ Non blocking)
5 I / O models:
- Blocking I / O
- Non blocking I / O
- I / O multiplexing (select, poll, epoll…)
- Signal driven I / O (sigio)
- Asynchronous I / O (AIO of POSIX)_ Series function)
For specific explanations of IO model, please refer to Five IO models of Linux