From a3961b2fd52b975c56789e74945249a9332dac66 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Fri, 22 Jun 2018 10:12:39 +0200 Subject: [PATCH] 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 --- man7/epoll.7 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/man7/epoll.7 b/man7/epoll.7 index 0d7b2c157..aab03332e 100644 --- a/man7/epoll.7 +++ b/man7/epoll.7 @@ -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