3 ms·
The problem is that all of select(2)'s competitors have a lot of problems as well. Because, as will be repeated below, I have no idea what I'm talking about, I
by qwertyuiop924 10y ago
The problem is that all of select(2)'s competitors have a lot of problems as well. Because, as will be repeated below, I have no idea what I'm talking about, I will be citing a relatively independant source, namely, the libev documentation.
-epoll: epoll is an absolute mess. Just read the manpage. Cantrill said it, and in this case he's right. But since Cantrill is hardly an independant souce, here's what the libev documentation has to say about epoll:
>The epoll mechanism deserves honorable mention as the most misdesigned of the more advanced event mechanisms: mere annoyances include silently dropping file descriptors, requiring a system call per change per file descriptor (and unnecessary guessing of parameters), problems with dup, returning before the timeout value, resulting in additional iterations (and only giving 5ms accuracy while select on the same platform gives 0.1ms) and so on. The biggest issue is fork races, however - if a program forks then both parent and child process have to recreate the epoll set, which can take considerable time (one syscall per file descriptor) and is of course hard to detect.
>Epoll is also notoriously buggy - embedding epoll fds should work, but of course doesn't, and epoll just loves to report events for totally different file descriptors (even already closed ones, so one cannot even remove them from the set) than registered in the set (especially on SMP systems).
[...]
>Epoll is truly the train wreck among event poll mechanisms, a frankenpoll, cobbled together in a hurry, no thought to design or interaction with others. Oh, the pain, will it ever stop...
-kqueue: kqueue isn't epoll, which is a massive advantage. However, once again according to libev (I do like to site people who know what they're doing, because I don't), it's at least somewhat broken on every system other than NetBSD: it only works with sockets and pipes on FreeBSD, and on OSX it's totally broken. If this is wrong, or has been fixed, please let me know: I'd love that.
-Eventports: according to libev (once again) eventports are probably the least broken: it's slower than select and poll on small scales, but scales up well. Apparently the interface is a bit quirky, and it has some problems ("The event polling function sometimes returns events to the caller even though an error occurred, but with no indication whether it has done so or not"), but it's a heck of a lot better than everything else.
So yes, Solaris wins. Again.
Dammit, Solaris: it's getting increasingly hard to argue with your fans, because the system is actually really nice.
- JdeBP 10y ago> it only works with sockets and pipes on FreeBSD Where did that rubbish come from? It certainly was not the FreeBSD doco. I've been happily using kevent with regular files, directories, child processes, pseudo-terminals, and signals for years. On OpenBSD, too. I cannot likewise personally attest to its support for process descriptors, timers, AIO requests, or BPF devices, but they're documented.
- qwertyuiop924 10y agoOh. Like I said, that's only what I've heard. It's good to know that's working now. So now Solaris doesn't win, it's just that Linux totally loses...
- JdeBP 10y agoI am not aware of it ever not working, since its creation.
- qwertyuiop924 10y agoI did point to my source: the documentation for libev, a widely used event library that abstracts over such OS-specific mechanisms. Whilebit may be outdated, I'm inclined to trust that it was true at some point, as it's more or less the libev maintainers' jobs to work with these interfaces day in and day out. It's possible they're incompotent, of course, but I find that unlikely.