63ALTERNATIVE I/O MODELS

This chapter discusses three alternatives to the conventional file I/O model that we have employed in most programs shown in this book:

• I/O multiplexing (the select() and poll() system calls);

• signal-driven I/O; and

• the Linux-specific epoll API.

63.1 Overview

Most of the programs that we have presented so far in this book employ an I/O model under which a process performs I/O on just one file descriptor at a time, and each I/O system call blocks until the data is transferred. For example, when reading from a pipe, a read() call normally blocks if no data is currently present in the pipe, and a write() call blocks if there is insufficient space in the pipe to hold the data to be written. Similar behavior occurs when ...

Get The Linux Programming Interface now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.