ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.pod
(Generate patch)

Comparing libev/ev.pod (file contents):
Revision 1.203 by root, Sun Oct 26 00:52:51 2008 UTC vs.
Revision 1.205 by root, Mon Oct 27 12:20:32 2008 UTC

384=item C<EVBACKEND_EPOLL> (value 4, Linux) 384=item C<EVBACKEND_EPOLL> (value 4, Linux)
385 385
386For few fds, this backend is a bit little slower than poll and select, 386For few fds, this backend is a bit little slower than poll and select,
387but it scales phenomenally better. While poll and select usually scale 387but it scales phenomenally better. While poll and select usually scale
388like O(total_fds) where n is the total number of fds (or the highest fd), 388like O(total_fds) where n is the total number of fds (or the highest fd),
389epoll scales either O(1) or O(active_fds). The epoll design has a number 389epoll scales either O(1) or O(active_fds).
390of shortcomings, such as silently dropping events in some hard-to-detect 390
391cases and requiring a system call per fd change, no fork support and bad 391The epoll syscalls are the most misdesigned of the more advanced
392support for dup. 392event mechanisms: probelsm include silently dropping events in some
393hard-to-detect cases, requiring a system call per fd change, no fork
394support, problems with dup and so on.
395
396Epoll is also notoriously buggy - embedding epoll fds should work, but
397of course doesn't, and epoll just loves to report events for totally
398I<different> file descriptors (even already closed ones, so one cannot
399even remove them from the set) than registered in the set (especially
400on SMP systems). Libev tries to counter these spurious notifications by
401employing an additional generation counter and comparing that against the
402events to filter out spurious ones.
393 403
394While stopping, setting and starting an I/O watcher in the same iteration 404While stopping, setting and starting an I/O watcher in the same iteration
395will result in some caching, there is still a system call per such incident 405will result in some caching, there is still a system call per such incident
396(because the fd could point to a different file description now), so its 406(because the fd could point to a different file description now), so its
397best to avoid that. Also, C<dup ()>'ed file descriptors might not work 407best to avoid that. Also, C<dup ()>'ed file descriptors might not work
398very well if you register events for both fds. 408very well if you register events for both fds.
399
400Please note that epoll sometimes generates spurious notifications, so you
401need to use non-blocking I/O or other means to avoid blocking when no data
402(or space) is available.
403 409
404Best performance from this backend is achieved by not unregistering all 410Best performance from this backend is achieved by not unregistering all
405watchers for a file descriptor until it has been closed, if possible, 411watchers for a file descriptor until it has been closed, if possible,
406i.e. keep at least one watcher active per fd at all times. Stopping and 412i.e. keep at least one watcher active per fd at all times. Stopping and
407starting a watcher (without re-setting it) also usually doesn't cause 413starting a watcher (without re-setting it) also usually doesn't cause

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines