Blocking I/O Model

  • the most prevalent I/O model
  • By default, all sockets are blocking.
  • With Blocking I/O, system call return when:
  • success
    • data copied to application space
  • error
    • interrupted by signal (most common)
    • others
  • Process blocked when calling these kind of system call.

NonBlocking I/O Model

  • when set a socket to be nonblocking
int flags = fcntl(socket, F_GETFL, 0);
fcntl(socket, F_SETFL, flags | O_NONBLOCK);

I/O Multiplexing Model