Comparison of select and epoll

Source: Internet
Author: User

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

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.