Using the Du (find) and cat to reflect the buffer vs. cache differences Experiment:
Experiments show that:
1 Normally buffer << cache
2 "File system" related content (Inode, etc.) cached in buffer, "file System"-independent (that is, file content) cached in the cache
With:
Objective: To improve the IO efficiency of Linux
Properties: Transparent to the program (everything is a file in Linux)
IO layer: Data that caches other slow IO layers in memory. (IO: Network < Disk < memory < CPU cache)
Vary
Buffer ' s policy is first-in, first-out
Cache ' s policy is Least recently used.
Before I simply thought:
Buffer is for a character device, and the cache is for a block device.
After studying today, I understand that buffer and cache become:
Buffer optimizes IO speed through management (Queue implementation async), and cache optimizes IO speed through memory (data dwell). Buffer is understood as an element queue and the cache is interpreted as a copy of the data.
2015-01-27-Understanding the difference between buffer and cache from the experiment-Wu Weishun