ABSTRACT

We discussed blocking I/O in detail in Chapters 19 and 20 while explaining the concept of a communication channel called the UNIX pipe, which is used for communication between related processes. A read() or write() call may be interrupted when you perform a blocking I/O on a pipe. In the case of a pipe, blocking input means that the read() system call blocks, as there is nothing to read because the pipe is empty. The write() system call blocks if the pipe is full. Another example of blocking read is when the read() system call reads input interactively from a keyboard. The read() call blocks until the user enters keyboard input. Similarly, the select() system call blocks while waiting for an I/O request on a descriptor. Finally, a process may block while waiting for a child process to terminate using any of the calls in the wait() class.