3 ms·
I can tell you some undesirable properties, which is what keeps motivating people to think of new ones. Bad property 1. Limited number of things you can block
by asveikau 8y ago
I can tell you some undesirable properties, which is what keeps motivating people to think of new ones.
Bad property 1. Limited number of things you can block on. select(2) can only do FD_SETSIZE descriptors.
Bad property 2. Entire list of descriptors needs to be re-examined on every blocking call. select(2) and poll(2) have this problem. Entering the syscall, the kernel needs to copy the list of descriptors, and after returning from it, the application needs to scan the list to see what changed - these are both O(N) operations. (Aside: Windows's WaitForMultipleObjects suffers from the former problem but not the latter, but has bad property #1 since it's limited to 64 handles.) epoll and kqueue fix this by having the kernel maintain the list of descriptors across calls, notifying you of which ones change.
Bad property 3. Too many syscalls, which epoll suffers from and this latest one is trying to solve. kqueue(2) tries to mitigate this by allowing you to batch add/remove descriptors, rather than doing a separate syscall for each.