Select and Epoll

Source: Internet
Author: User
Tags epoll
The two mechanisms of select and Epoll are multi-path I/O mechanism solutions, select is the POSIX standard, and Epoll is unique to Linux.
The biggest benefit of epoll is that it does not decrease efficiency with the number of FD, polling processing in Selec, where the data structure is similar to the data structure of an array, and epoll is maintaining a queue, directly looking at whether the queue is empty.
Nginx is the use of epoll to achieve I/O multiplexing support high concurrency, currently in high concurrency scenarios, nginx more and more welcome.
A disadvantage of select is that there is a maximum limit on the number of file descriptors that a single process can monitor
Epoll:
(1) The efficiency of IO does not decrease as the number of monitored FD increases. Epoll is not the same as select and poll polling, but is implemented by each FD-defined callback function. Only the ready FD will execute the callback function;
(2) Support level-triggering and edge-triggering (just tell the process which file descriptor has just become ready, it only says it again, if we do not take action, then it will not be told again, this way is called edge triggering) two ways, the theoretical edge trigger performance is higher, but the code implementation is quite complex.
(3) Have a good notification mechanism for readiness events
Select
(1) The number of FD that can be monitored by a single process is limited, and on a 32-bit machine, the maximum number of FD He can manage is 1024;
(2) When scanning the socket is a linear scan, when the number of socket file descriptor has changed, a lot of time is wasted.

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('

  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the select and Epoll, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.