1. drop_caches
The following descriptions are available in documentation/sysctl/vm.txt:
Drop_caches
Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
To free pagecache:
Echo 1>/proc/sys/Vm/drop_caches
To free dentries and inodes:
Echo 2>/proc/sys/Vm/drop_caches
To free pagecache, dentries and inodes:
Echo 3>/proc/sys/Vm/drop_caches
As this is a non-destructive operation and dirty objects are not freeable, the user shoshould run 'sync' first.
2. Differences between cache and Buffer
Cache: high-speed cache is a memory with a small capacity but high speed located between the CPU and the main memory. Because the CPU speed is much higher than the master memory, it takes a certain period of time for the CPU to directly access data from the memory. The cache stores part of the data that has just been used by the CPU or is used cyclically, when the CPU uses this part of data again, it can be called directly from the cache, which reduces the CPU wait time and improves the system efficiency. Cache is divided into Level 1 cache (L1 cache) and level 2 cache (L2 cache). L1 cache is integrated into the CPU, and L2 cache is usually soldered to the motherboard in the early stages, it is also integrated into the CPU. The common capacity is kb or kb.
L2 cache.
Buffer: a buffer used to transmit data between devices with Different Storage speeds or between devices with different priorities. Through the buffer zone, mutual waits between processes can be reduced, so that when reading data from a slow device, the operation process of the fast device will not interrupt.
Buffer and cache in free: (both occupy memory ):
Buffer: the memory used as the buffer cache. It is the read/write buffer of Block devices.
Cache: Memory Used as the page cache, the cache of the file system
If the cache value is large, the number of files in the cache is large. If files frequently accessed can be cached, the disk read Io BI will be very small.