Summary
Nonblocking I/O is a double-edged sword. On the one hand, it makes it possible to write servers that can process multiple simultaneous connections without spawning new processes or threads. Compared to the multiprocessing solutions, nonblocking I/O has a slight performance edge and consumes fewer system resources. Nonblocking I/O is also the only viable solution for creating multiconnection servers that will run on platforms that do not support the fork() or thread APIs, such as the Macintosh.
On the other hand, nonblocking I/O significantly increases the complexity of networking software. Most of this complexity comes from the overhead of keeping track of partial writes and handling EWOULDBLOCK errors from syswrite() and sysread()
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access