epoll VS select
Asked Answered
D

2

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

Desouza answered 10/6, 2011 at 7:53 Comment(1)
#2033098Laux
P
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.

Puebla answered 10/6, 2011 at 7:56 Comment(1)
hmm, both of them should be synchronous IOSwarey
L
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..)

Lithometeor answered 9/4, 2015 at 7:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.