Difference select, poll, epoll of: IO multiplexing mechanism

Difference select, poll, epoll of: IO multiplexing mechanism

1. a single process open file descriptors (fd file handle) is inconsistent

select: maximum number of connections to limit the number of 1024, the maximum number of connections to a single process can open is defined by FD_ZETSIZE macro.

poll: the poll is essentially no difference between the select, but it does not limit the maximum number of connections, because it is based on a linked list to store.

epoll: While connected to the ceiling, but great, 1G memory machines can open a connection to about 100,000, and so on.

2. monitor Socket manner inconsistent

select: polling way, one by one socket to check in the past, found only active socket processing, when an increase in the linear socket, polling speed will become very slow, resulting in a linear cause performance degradation.

poll: to select slightly optimized, just modify the file descriptor, but the listening socket way or polling.

expoll: epoll kernel implementation is achieved according to the callback function on each fd, only active socket will take the initiative to call callback, inform expoll to deal with this socket. (Socket connections will be registered to epoll, the equivalent roster socket, if there is a socket active, a callback function will notify epoll, hurried over processing)

3. The memory copy mode (mode messaging) is inconsistent

select: the kernel passes the message to the user would like to state the need to copy data from user mode to kernel mode, this process is very time-consuming

poll: ditto

epoll: epoll kernel and user space of a shared memory, so the memory state data and the user data is shared state

Guess you like

Origin www.cnblogs.com/846617819qq/p/10973862.html