
Ask HN: Why isnt there a syscall to read/write to multiple file desc. on linux? - soulbadguy
I am currently playing around with linux epoll interface in order to better understand boost.io and libuv. Upon epoll returns, It looks like the ready file descriptors have to be processed in sequence with one system call per ready file descriptors. Is there a better pattern to process multiple ready file descriptors?<p>PS : Linux has a vectored&#x2F;io interface but it does not seems to support multiple fds.
======
wmf
Linux is based on the idea that system calls are cheap (whether this idea is
correct or not), so they prefer to avoid system calls that perform multiple
operations.

But there has been research on this topic:
[https://www.usenix.org/node/170841](https://www.usenix.org/node/170841)
[https://www.usenix.org/node/186147](https://www.usenix.org/node/186147)

------
JoachimSchipper
No, there's no better pattern than select/poll/epoll/kqueue-then-multiple-
read.

Using many threads or async I/O can allow you to handle multiple file
descriptors, but these are hardly convenient - and it's easy to end up with
less-performant code.

~~~
JoachimSchipper
Fwiw: you can, however, send multiple datagrams to multiple hosts with
sendmmsg(). Still one socket at a time, but...

