… | |
… | |
317 | For few fds, this backend is a bit little slower than poll and select, |
317 | For few fds, this backend is a bit little slower than poll and select, |
318 | but it scales phenomenally better. While poll and select usually scale |
318 | but it scales phenomenally better. While poll and select usually scale |
319 | like O(total_fds) where n is the total number of fds (or the highest fd), |
319 | like O(total_fds) where n is the total number of fds (or the highest fd), |
320 | epoll scales either O(1) or O(active_fds). The epoll design has a number |
320 | epoll scales either O(1) or O(active_fds). The epoll design has a number |
321 | of shortcomings, such as silently dropping events in some hard-to-detect |
321 | of shortcomings, such as silently dropping events in some hard-to-detect |
322 | cases and rewuiring a syscall per fd change, no fork support and bad |
322 | cases and rewiring a syscall per fd change, no fork support and bad |
323 | support for dup: |
323 | support for dup: |
324 | |
324 | |
325 | While stopping, setting and starting an I/O watcher in the same iteration |
325 | While stopping, setting and starting an I/O watcher in the same iteration |
326 | will result in some caching, there is still a syscall per such incident |
326 | will result in some caching, there is still a syscall per such incident |
327 | (because the fd could point to a different file description now), so its |
327 | (because the fd could point to a different file description now), so its |
… | |
… | |
949 | |
949 | |
950 | This is how one would do it normally anyway, the important point is that |
950 | This is how one would do it normally anyway, the important point is that |
951 | the libev application should not optimise around libev but should leave |
951 | the libev application should not optimise around libev but should leave |
952 | optimisations to libev. |
952 | optimisations to libev. |
953 | |
953 | |
954 | =head3 Ths special problem of dup'ed file descriptors |
954 | =head3 The special problem of dup'ed file descriptors |
955 | |
955 | |
956 | Some backends (e.g. epoll), cannot register events for file descriptors, |
956 | Some backends (e.g. epoll), cannot register events for file descriptors, |
957 | but only events for the underlying file descriptions. That menas when you |
957 | but only events for the underlying file descriptions. That menas when you |
958 | have C<dup ()>'ed file descriptors and register events for them, only one |
958 | have C<dup ()>'ed file descriptors and register events for them, only one |
959 | file descriptor might actually receive events. |
959 | file descriptor might actually receive events. |