epoll.7: Note that edge-triggered notification wakes up only one waiter

Note a useful performance benefit of EPOLLET: ensuring that
only one of multiple waiters (in epoll_wait()) is woken
up when a file descriptor becomes ready.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2018-06-22 10:12:39 +02:00
parent 0409116028
commit a3961b2fd5
1 changed files with 17 additions and 0 deletions

View File

@ -200,6 +200,23 @@ it is the caller's responsibility to rearm the file descriptor using
.BR epoll_ctl (2)
with
.BR EPOLL_CTL_MOD .
.PP
If multiple threads
(or processes, if child processes have inherited the
.B epoll
file descriptor across
.BR fork (2))
are blocked in
.BR epoll_wait (2)
waiting on the same the same epoll file descriptor and a file descriptor
in the interest list that is marked for edge-triggered
.RB ( EPOLLET )
notification becomes ready,
just one of the threads (or processes) is awoken from
.BR epoll_wait (2).
This provides a useful optimization for avoiding "thundering herd" wake-ups
in some scenarios.
.\"
.SS Interaction with autosleep
If the system is in
.B autosleep