IO - 同步,异步,阻塞,非阻塞

转自
http://blog.csdn.net/historyasamirror/article/details/5778378

总结:
一、io操作分两阶段:
对于一个network IO (这里我们以read举例),它会涉及到两个系统对象,一个是调用这个IO的process (or thread),另一个就是系统内核(kernel)。当一个read操作发生时,它会经历两个阶段:
1 等待数据准备 (Waiting for the data to be ready)
2 将数据从内核拷贝到进程中 (Copying the data from the kernel to the process)

二、同步io与异步io区别:
两者的区别就在于synchronous IO做“IO operation”的时候会将process阻塞。只要在两阶段中有阻塞,都视为同步io。

猜你喜欢

转载自zheng19851.iteye.com/blog/2201999