Check out my first novel, midnight's simulacra!

Epoll: Difference between revisions

From dankwiki
No edit summary
 
No edit summary
Tags: mobile web edit mobile edit
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
I don't like epoll so much as [[FreeBSD|FreeBSD's]] [[kqueue]], although many of its deficiencies have been overcome with the [http://kerneltrap.org/2.6.25 2.6.25 kernel release] and its addition of <code>timerfd_*</code> and <code>signalfd_*</code> functionality ([http://lwn.net LWN] had a good article regarding <code>timerfd</code> [http://lwn.net/Articles/245533/ here]). Note that these latter functions require [[glibc]] version 2.8 or later, or use of the <code>syscall()</code> multiplexer.
I don't like epoll so much as [[FreeBSD|FreeBSD's]] [[kqueue]], although many of its deficiencies have been overcome with the [http://kerneltrap.org/2.6.25 2.6.25 kernel release] and its addition of <code>timerfd_*</code> and <code>signalfd_*</code> functionality ([http://lwn.net LWN] had a good article regarding <code>timerfd</code> [http://lwn.net/Articles/245533/ here]). Note that these latter functions require [[glibc]] version 2.8 or later, or use of the <code>syscall()</code> multiplexer. EPOLLRDHUP was not added until 2.6.17.
 
<tt>EPOLLEXCLUSIVE</tt> was added in Linux 4.5, and wakes up only one thread for events when multiple threads are blocking on epoll.
 
==System Limits==
* <tt>/proc/sys/fs/epoll/max_user_watches</tt>, since Linux 2.6.28, "specifies a limit on the total number of file descriptors that a user can register across all epoll instances on the system. The limit is per real user ID. Each registered file descriptor costs roughly 90 bytes on a 32-bit kernel, and roughly 160 bytes on a 64-bit kernel. Currently, the default value for max_user_watches is 1/25 (4%) of the available low memory, divided by the registration cost in bytes."
 
==External links==
* [https://idea.popcount.org/2017-02-20-epoll-is-fundamentally-broken-12/ Epoll is fundamentally broken] by Marek 2017-02-20

Latest revision as of 07:48, 14 May 2023

I don't like epoll so much as FreeBSD's kqueue, although many of its deficiencies have been overcome with the 2.6.25 kernel release and its addition of timerfd_* and signalfd_* functionality (LWN had a good article regarding timerfd here). Note that these latter functions require glibc version 2.8 or later, or use of the syscall() multiplexer. EPOLLRDHUP was not added until 2.6.17.

EPOLLEXCLUSIVE was added in Linux 4.5, and wakes up only one thread for events when multiple threads are blocking on epoll.

System Limits

  • /proc/sys/fs/epoll/max_user_watches, since Linux 2.6.28, "specifies a limit on the total number of file descriptors that a user can register across all epoll instances on the system. The limit is per real user ID. Each registered file descriptor costs roughly 90 bytes on a 32-bit kernel, and roughly 160 bytes on a 64-bit kernel. Currently, the default value for max_user_watches is 1/25 (4%) of the available low memory, divided by the registration cost in bytes."

External links