What is the difference and select epool

select open in a process maximum fd is limited by FD_SETSIZE set, the default value is 2048. But epoll is not the limit, it supports fd upper limit is the maximum number of files that can be opened, this number is generally much larger than the 2048 general memory, the greater the upper limit fd, 1G memory can reach about 10w.

 

Select polling mechanism is that the system will look for each fd whether the data is ready, when fd lot of time, the efficiency of course fell on a straight line, epoll event-based notification, and once a fd data ready, the kernel using a callback mechanism similar to the callback, the rapid activation of this file descriptors, without the need to constantly look ready to go to the polling descriptor, which is why most essential epool efficient.

 

Either select or epoll kernel needs to FD message notification to the user space, how to avoid unnecessary memory copy is very important, at this point, epoll by kernel to user space mmap the same memory to achieve, and then select to do unnecessary copies

Guess you like

Origin www.cnblogs.com/tiancai/p/11698341.html