2021-02-24
[Translation] Blocking IO Nonblocking IO and Epoll

In this post I want to explain exactly what happens when you use nonblocking I/O. In particular, I want to explain:

  • The semantics of setting O_NONBLOCK on a file descrpter using fcntl

  • How nonblocking I/O is different from asynchronous I/O

  • Why nonblocking I/O is frequently used in conjunction with I/O multiplexers like select, epoll, and kqueue

  • How nonblocking mode interacts with edge-triggered polling with epoll

在这篇博文中,我想解释当使用 非阻塞IO 时确切发生了什么。具体地,我想解释:

  • 在一个文件描述上使用 fcntl 为其设置 O_NONBLOCKING 标志的那些语义

  • 非阻塞IO 与 异步IO 如何不同

  • 为什么 非阻塞IO 经常和 IO复用,如select, epollkqueue 一起使用

  • 非阻塞模式如何与 epoll 边沿触发 (edge-trigered) 轮训方式交互

Read More