Ask HN: Why isnt there a syscall to read/write to multiple file desc. on linux?

3 points by soulbadguy ↗ HN
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?

PS : Linux has a vectored/io interface but it does not seems to support multiple fds.

3 comments

[ 1510 ms ] story [ 1801 ms ] thread
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.

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