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
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
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.
synchronous IO
–
Swarey 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..)
© 2022 - 2024 — McMap. All rights reserved.