I/O模型学习小记

2016-04-03  本文已影响0人  snowind09

基础概念

  1. 通过I/O模型学习同步/异步、阻塞/非阻塞基础概念,参考资料如下:
    《Unix网络编程》
    《网络编程释疑之:同步,异步,阻塞,非阻塞》
    《Java NIO:浅析I/O模型》
    《高性能IO模型浅析》

  2. 基础概念学习小结

多路复用模型(IO Multiplexing)

容易发生混淆的坑

很多人将多路复用模型(IO Multiplexing)称之为异步阻塞I/O,这种方式将引起误解,为此,澄清如下:

Synchronous I/O versus Asynchronous I/O

POSIX defines these two terms as follows:

A synchronous I/O operation causes the requesting process to be blocked until that I/O operation completes.
An asynchronous I/O operation does not cause the requesting process to be blocked.

Using these definitions, the first four I/O models (blocking, nonblocking, I/O multiplexing, and signal-driven I/O) are all synchronous because the actual I/O operation (recvfrom) blocks the process. Only the asynchronous I/O model matches the asynchronous I/O definition.

上一篇 下一篇

猜你喜欢

热点阅读