转自
[url]http://blog.youkuaiyun.com/historyasamirror/article/details/5778378[/url]
[color=darkred]总结:[/color]
[b]一、io操作分两阶段:[/b]
对于一个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)
[b]二、同步io与异步io区别:[/b]
两者的区别就在于synchronous IO做“IO operation”的时候会将process阻塞。只要在两阶段中有阻塞,都视为同步io。
[url]http://blog.youkuaiyun.com/historyasamirror/article/details/5778378[/url]
[color=darkred]总结:[/color]
[b]一、io操作分两阶段:[/b]
对于一个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)
[b]二、同步io与异步io区别:[/b]
两者的区别就在于synchronous IO做“IO operation”的时候会将process阻塞。只要在两阶段中有阻塞,都视为同步io。