29
Application I/O Interface
- Blocking vs. Nonblocking devices.
- This is about whether a program should wait for I/O to be ready, or let the program continue executing other instructions, without waiting for the I/O data transfer to finish.
- With blocking I/O, a program is moved to the "wait" queue when an I/O request is made, and moved back to the ready queue (to continue running) when the request completes, allowing other processes to run in the meantime while the current program waits.
- With nonblocking I/O, the I/O request returns immediately, whether the requested I/O operation has (completely) occurred or not. This allows the program to check for available data without getting hung completely if it is not there.
- A nonblocking I/O call returns quickly, with a return value that indicates how many bytes were transferred.