The Linux Programming Interface
File I/O Buffering
(01) 内容
In this chapter, we describe both types of buffering and consider how the affect application performance.
(02)cache技术
write(fd, "abc", 3)
内核先把abc写入到buffer中,然后flush,之后再写到disk中。
(03)目的
The aim of this design is to allow read() and write() to be fast, since they don't need to wait on a (slow) disk operation.
This design is also efficient, since it reduces the number of disk transfers that the kernel must perform.
(04)整个读写过程图
(05)直接文件操作,不需要buffer
(06)总结
Buffering of input and output data is performed by the kernel, and also by the stdio