The following are based on the Liunx system

This section describes the concepts of blocking, non-blocking, synchronous, and asynchronous

Blocking/non-blocking is blocking from the point of view of a function call

If the read or write is not ready or completed, the function waits.Copy the code

non-blocking

The function returns immediately and then lets the application poll.Copy the code

Synchronous/asynchronous is synchronization in terms of who does the reading and writing

Read and write is done by the application (meaning that while reading and writing, the application cannot process new tasks)Copy the code

asynchronous

The read and write is done by the operating system (meaning that the application is free to handle new tasks), and when it is done, the application is notified by a callback or event.Copy the code

Asynchronous I/ OS must be non-blocking I/ OS. Both asynchronous AND blocking I/ OS do not exist. Synchronous I/O can be blocking or non-blocking. There are three types of I/ OS: synchronous blocking I/ OS, synchronous non-blocking I/ OS, and asynchronous I/ OS.

I/O multiplexing (SELECT, poll, epoll) SELECT, poll, and epoll are synchronous I/O because the read and write functions are performed by the application and block I/O because the select, read, and write calls are blocked.

Continue to add…