Linux event-driven IO in select vs epoll

background

Select and epoll different background, select a POSIX standard, code portability is good, epoll is a Linux standard, code portability between Linux operating system only.

Triggering conditions

select only supports triggering conditions (level-triggered), epoll support conditional trigger and edge trigger.

  Triggering conditions (level-triggered): When the conditions are met, an I / O event occurs.

  Edge-triggered (edge-triggered): When the state changes, an I / O events.

Conditions required to trigger a low encoding code is not easy to lose an event, at high flow, high concurrency environment, efficiency is not good, as long as there is no data processing cores continue to inform you.

Edge trigger, coding complexity, the need to prevent loss events, circumstances prone event loss.

Handling of file descriptor

select maximum support 1024 file descriptors, the choice of descriptors, through all descriptors which descriptors can get to an event notification, and low efficiency.

For a description of selection is not traversed epoll event identifier, event response descriptor on the event immediately selected, the handle does not need to traverse the entire list, the efficiency is very high.

 

 

Guess you like

Origin www.cnblogs.com/shuiyonglewodezzzzz/p/11495161.html