Introduction
Network I/O is fundamental to understanding how data flows across computer networks. Before looking at the different network I/O models, we should first have a clear picture of how data moves. The diagram below shows how data flows.
I/O is actually a very basic part of a request: reading request data, writing response data, plus disk I/O and calls to other application servers.
for conn in open_connections:
read(conn)
Most network code examples probably look like the snippet above. By default, the read system call blocks. If a connection is established but no data has been written, our program gets stuck waiting and cannot respond to other connections. So we need a way to handle long-running I/O requests.
Fortunately, there are five ways to handle I/O. Let's go through them one by one.
Blocking
The system call does not return until data arrives and has been copied into our application. This is workable in a multithreaded environment: even if some threads are blocked, we still have other threads available to serve requests.
Nonblocking
If data is unavailable, the system call can return EWOULDBLOCK immediately instead of blocking.
We can loop over all connections, and if no data is available, poll the connections, consuming CPU.
I/O Multiplexing
Rather than handling just one file descriptor at a time, we need a way to monitor changes across multiple file descriptors. (SELECT/POLL/EPOLL/KQUEUE) are just different methods for this kind of monitoring.
SELECT
select lets you pass in a list of file descriptors and returns the status of each FD. It has some fairly significant performance limitations. Every call to select requires copying the entire file descriptor set from user space to kernel space, which can cause performance problems when there are many file descriptors. The number of file descriptors is limited (1024).
POLL
Poll is similar to select, but it uses an array of pollfd structs to store the file descriptor set. Each struct records a single file descriptor along with its requested events and the events that actually occurred. When there are many file descriptors being monitored, performance is worse than epoll because it must traverse the entire array to check for status changes. Like select, each call to poll also requires copying the entire file descriptor array into kernel space.
EPOLL
Epoll is an I/O multiplexing technique specific to Linux. It manages multiple file descriptors by creating an epoll instance. Use epollctl to add, modify, or remove monitored events for file descriptors, while epollwait waits for events to occur.
KQUEUE
Kqueue is an I/O multiplexing technique in BSD systems. It uses event filters to monitor various events (including file descriptor events and other types of events).
Here’s a more in depth comparison of select / poll / epoll

Performance comparison chart
Signals
Instead of checking the status of a file descriptor, we can ask the kernel to send us a signal when data is available.
Although signal-driven I/O is convenient for some applications, especially simple applications under low load, it is usually not the first choice in high-performance and high-concurrency environments. Signal handling can cause problems in multithreaded environments because signal handling typically interrupts the current process execution, which can lead to race conditions and other concurrency issues.
Asynchronous I/O (AIO)
The application initiates an I/O operation and is notified when the operation completes (via a signal). Similar to SIGIO, except that the application is notified once data has been moved into the application buffer.
POSIX AIO
POSIX asynchronous I/O is provided through the libaio library. On Linux systems, this approach is mainly suitable for disk files; support for network sockets is not very good. Although it may technically be possible through certain hacks, POSIX AIO is not recommended for network I/O in production environments.
IO_URING
Linux 5.1 and later introduced the io_uring interface, a new high-performance asynchronous I/O framework designed to overcome the limitations of the traditional Linux AIO interface. io_uring supports asynchronous operations on files and sockets and provides higher efficiency and lower CPU overhead than traditional methods.
io_uring submits and completes I/O requests through a ring queue mechanism, which is well suited to high-throughput I/O operations. It allows user-space applications to interact directly with kernel space, reducing the number of system calls and related overhead.
Summary

Comparison of I/O models in Unix Network Programming