4 ms·
The kernel walks the list of threads until it finds one that's actually blocked in epoll_wait(). Suppose that at any given time, most of your threads are runni
by danarmak 10y ago
The kernel walks the list of threads until it finds one that's actually blocked in epoll_wait().
Suppose that at any given time, most of your threads are running, not blocked (which is why you need this many threads). The kernel will always wake the first blocked thread in the list, so the few blocked threads will cluster towards the end of the list. And the kernel will have to walk most of the list to find a thread to unblock.
This is speculation; I haven't benchmarked anything.