A. Free command
[Email Protected]_202_12/]# free-m
Total used free shared buffers Cached
mem:3072 2459 612 0 207 1803
-/+ buffers/cache:447 2624
swap:1913 0 1913
Line 2nd:
Total Memory: 3072
Used number of memory used: 2459
Free Memory Number: 612
GKFX is currently obsolete. No, always 0.
Buffers:buffer Cache Memory: 13220
Cached:page Cache Memory: 2720160
Relationship: total = used + Free
Line 3rd:
the meaning of-/+ buffers/cache :
-buffers/cache Memory: 447 (equals 1th row of used-buffers-cached)
+buffers/cache Memory: 2624 (equals 1th line of Free + buffers + cached)
Note: The amount of memory here is a little bit out of size after calculating it with the above formula (you don't know what the reason is).
The visible-buffers/cache reflects the memory that is actually eaten by the program, and +buffers/cache reflects the total amount of memory that can be appropriated .
Line 4th is separate for the swap partition.
In order to improve disk access efficiency, Linux has done some careful design, in addition to the Dentry cache (for VFS, speed up the file path name to Inode conversion), but also adopted two main cache mode: Buffer cache and Page cache. The former is for the disk block read and write, the latter for the file inode read and write. These caches effectively shorten the time for I/O system calls (such as read,write,getdents).
line 2nd (MEM) Used/free and 3rd (-/+ Buffers/cache) used/free difference:
from the OS point of view, because the os,buffers/cached are all part of being used, so his available memory is 612MB , the used memory is 2059MB, including, the kernel (OS) uses +application (X, Oracle, etc) using the +buffers+cached.
. So from the application's point of view, available memory = System Free memory+buffers+ Cached .
As in the above example:
2624= 612+207+1803
-----------------------------
Cache Manual Release:
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
Note that it is best to sync before releasing to prevent data loss
Description:/proc is a virtual file system that can be used as a means of communicating with kernel entities through read and write operations. This means that you can make adjustments to the current kernel behavior by modifying the files in the/proc. This means that we can release the memory by adjusting the/proc/sys/vm/drop_caches. 0– does not release the--release page Cache--release dentries and Inodes 3– release all cachesThe number 1 is used to clear the most recently asked file page cacheThe number 2 is used to empty the file node cache and the directory entry cachethe number 3 is the cache used to empty 1 and 2 of all content.
Second, the difference between buffers and cached:
buffers is the buffer size used to make a block device , and he only records the file system's metadata and tracking in-flight pages.
Cached is used to buffer files.
That is, buffers is used to store content, permissions, and so on in the directory, and cached is used to remember the files we open.
If you want to know if he's really coming into effect, you can try and execute two orders in succession # Man kill, you can obviously feel that the second fight is much faster.
experiment: it would be obvious to do it on a machine with no application. Remember that the experiment can only be done once, if you want to do more please change a file name.
#free
#man kill
#free
#man kill
#free
Compare the size of the buffers shown in the free.
#free
#ls/dev
#free
Compare the size of two Of course, this buffers is increasing at any time, but with LS, the increase of speed will become faster, this is the difference between buffers/chached.
Because Linux uses temporarily unused memory as a file and data cache to improve system performance, the system is automatically freed when the application needs these memory (unlike Windows, even if you have a lot of free memory, he will have access to the pagefiles on the disk)
Memory Exchange conditions and methods:
When the available memory is less than the rated value, the Exchange begins.
How to view ratings (RHEL4.0)
#cat/proc/meminfo
The exchange will reduce the number of physical pages used in the system in three ways:
1. Reduce the buffer and the size of the page cache;
2. Swap out the memory page of the System V type;
3. Swap out or discard the page. (Application occupies a memory page, that is, insufficient physical memory).
In fact, a small amount of swap usage does not affect system performance.
Linux_free (buffer differs from cache)