# Select is fundamentally broken

DevFeed: [Select is fundamentally broken](<https://devfeed.tech/articles/select-is-fundamentally-broken-38958.md>)

Original publisher: [Read original article](<https://idea.popcount.org/2017-01-06-select-is-fundamentally-broken>)

Author: Marek

Published: 2017-01-05T23:00:00Z

Content type: article

Language: en

Sources: [Marek Majkowski](<https://devfeed.tech/sources/marek-majkowski.md>)

Topics: [Kernel](<https://devfeed.tech/topics/kernel.md>), [Linux Kernel](<https://devfeed.tech/topics/linux-kernel.md>), [TCP/IP](<https://devfeed.tech/topics/tcp-ip.md>), [freebsd](<https://devfeed.tech/topics/freebsd.md>)

Tags: [applications](<https://devfeed.tech/tags/applications.md>), [article](<https://devfeed.tech/tags/article.md>), [blog](<https://devfeed.tech/tags/blog.md>), [blog-post](<https://devfeed.tech/tags/blog-post.md>), [book](<https://devfeed.tech/tags/book.md>), [bsd](<https://devfeed.tech/tags/bsd.md>), [but](<https://devfeed.tech/tags/but.md>), [can](<https://devfeed.tech/tags/can.md>), [console](<https://devfeed.tech/tags/console.md>), [design](<https://devfeed.tech/tags/design.md>), [designers](<https://devfeed.tech/tags/designers.md>), [emulation](<https://devfeed.tech/tags/emulation.md>), [found](<https://devfeed.tech/tags/found.md>), [freebsd](<https://devfeed.tech/tags/freebsd.md>), [games](<https://devfeed.tech/tags/games.md>), [good](<https://devfeed.tech/tags/good.md>), [history](<https://devfeed.tech/tags/history.md>), [i](<https://devfeed.tech/tags/i.md>), [i-o](<https://devfeed.tech/tags/i-o.md>), [select](<https://devfeed.tech/tags/select.md>)

## AI overview

The article argues that `select` is heavyweight because each call requires the kernel to inspect descriptors and register or remove callbacks, and that shared sockets can trigger a thundering herd of process wakeups. Its experiments report localhost nonblocking `connect()` taking about 35 ms with 16,000 processes waiting in `select`, and about 1.5 seconds when each process watches 1,020 duplicate descriptors. The author says `epoll` avoids repeated registration through `epoll_ctl`, while Linux's `EPOLLEXCLUSIVE` reduces wakeups in the average case but does not remove the underlying O(N) dispatch cost. The proposed direction is to reconsider the registration model using interfaces such as `kqueue` and Windows IOCP. These are claims and measurements from the supplied article excerpt.

## Source excerpt

Select is fundamentally broken I/O multiplexing part #2 In a previous blog post we discussed a brief history of the syscall. The article concludes that some I/O multiplexing was necessary to do console emulation, games and non-trivial TCP/IP applications. The BSD designers chose the multiplexing model and other Unixes followed. But is the only multiplexing model? A good explanation can be found in the old revision of "The Design and Implementation of the FreeBSD Operating System" book.