Mechanism:
Select: only horizontal triggering is supported (unlimited notifications are not processed)
Epoll: supports horizontal triggering and edge triggering (only one notification)
Number of FD monitored by a single process
Select: It is set by fd_setsize. The default value is 2048. In the case of a large number of connections, it is obviously insufficient.
Epoll: it is related to the memory. The 1 GB memory is 10 W and generally enough.
Kernel monitoring Event Policy
Select: it traverses the monitoring handle array in sequence and is inefficient when monitoring a large number of connection handles and data communication is inactive.
Epoll: Active handles are automatically notified of events through the callback function, and resource consumption is too small;
How to obtain the event handle in the program
Select: returns the entire monitoring handle array. You can only traverse the entire array to find the event-triggered handle.
Epoll: The returned array is the handle of all triggered events.
Data Transmission
Select: copy is required for data transmission between kernel and user States.
Epoll: MMAP maps data spaces and removes the need for copy operations.
Comparison of select and epoll