Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In this chapter, we explored various alternatives to the standard model for performing I/O: I/O multiplexing (select() and poll()), signal-driven I/O, and the Linux-specific epoll API. All of these mechanisms allow us to monitor multiple file descriptors to see if I/O is possible on any of them. None of these mechanisms actually performs I/O. Instead, once we have determined that a file descriptor is ready, we use the traditional I/O system calls to perform the I/O.
The select() and poll() I/O multiplexing calls simultaneously monitor multiple file descriptors to see if I/O is possible on any of the descriptors. With both system calls, we pass a complete list of to-be-checked file descriptors to the kernel on each system call, and the kernel returns a modified list indicating which descriptors are ready. The fact that complete file descriptor lists are passed and checked on each call means that select() and poll() perform poorly when monitoring large numbers of file descriptors.