First, why the introduction of caching technology
In order to solve the problem of CPU speed and external device speed mismatch.
Reduces the number of IO interrupts to the CPU. Each IO device takes a long time, so the data is put into the buffer before the IO operation.
Second, the implementation of buffer technology
Classification of buffers:
(1) Set the buffer in the device
(2) setting buffers in memory
If the data is read, the disk's data is read into the memory buffer of the operating system kernel through DMA, then the process is read again.
III. IO with cache and non-cached IO
IO operations with no cache:
In the Linux operating system, read (), write (), and other system calls are non-cached IO operations, which write bytes in the application process to the kernel buffer, and then call the Fsync () function to synchronize to disk.
Io operation with cache:
In the application process, there is also a file buffer, until the buffer fills up, then call Read (), write () and other system calls, put the data into the kernel buffer.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Operating system--io Caching technology