8

I have read a couple of networking books to get some idea of differences between epoll and select but they only covered this concepts slightly. I will be appreciated if you guys can provide me the key differences in details.

Thanks in advance

codereviewanskquestions
  • 13,460
  • 29
  • 98
  • 167
  • http://stackoverflow.com/questions/2032598/caveats-of-select-poll-vs-epoll-reactors-in-twisted – Young Jun 10 '11 at 07:57

2 Answers2

15

select is the standard Unix facility for doing asynchronous IO. Its programming interface is quirky, and its implementation in most Unixes is mediocre at best. It also imposes a limit on the maximum number of descriptors a process can watch, which is inconvenient in an application. Regarding efficiency, the performance of select usually degrades linearly with the number of descriptors.

epoll is a huge improvement over select in terms of programming interface and efficiency, but is only provided in Linux starting from version 2.6. Other Unixes have their specialised calls, too.

Blagovest Buyukliev
  • 42,498
  • 14
  • 94
  • 130
1

select always delivery descriptors to kernel when calling select().
But epoll delivery the descriptor once when calling epoll_ctl() and get events by calling epoll_wait().

And loop 0 to max_descriptor for checking events when using select.
But loop for event occured descriptors for checking events when using epoll.

These makes the difference in performance.

And select has a limit of maximum number of descriptors because it use bit array.
But epoll don't have a limit because it use structure array.

And select exists in most of platforms (windows, linux, unix, bsd)
But epoll exists only in linux.
Of course, there exists replacements of epoll in other platforms (IOCP in windows, kqueue in bsd, etc..)

taeguk
  • 26
  • 4