The following shows the usage of the current memory.-M indicates that the content is displayed in MB bytes. Let's take a look.
$ Free-m
Total used free shared buffers cached
Mem: 1002 769 232 0 62 421
-/+ Buffers/cache: 286 715
Swap: 1153 0 1153
Part 1 mem row:
Total memory: 1002 MB
Used memory used: 769 MB
Free idle memory: 232 MB
Shared is no longer used. It is always 0.
Buffers buffer cache memory: 62 MB
Cached page cache memory: 421 MB
Link: Total (1002 m) = used (769 m) + free (232 m)
Part 2 (-/+ buffers/cache ):
(-Buffers/cache) used memory size: 286 MB (refers to used-Buffers-cached in the first part of the mem row)
(+ Buffers/cache) free memory: 715 MB (refers to the first part of the mem row free + buffers + cached)
Visible-Buffers/cache indicates that Program The actually consumed memory, while the + buffers/cache reflects the total number of memories that can be used.
The third part refers to swap partitions. I don't want to understand it.
I think you are still dizzy after reading the above. The first part (MEM) and the second part (-/+ buffers/cache) are so strange about used and free.
In fact, we can explain it in two ways.
For the operating system, it is the mem parameter. buffers/cached are all used, so it is considered that free is only 232.
For applications (-/+ buffers/cach ). buffers/cached is equivalent to available, because buffer/cached is used to improve the performance of program execution. When the program uses memory, buffer/cached will be quickly used.
So let's take a look at the application. The free and used of (-/+ buffers/cache) are the main ones. so let's just look at this. in addition, I would like to tell you some common sense. in order to improve disk and memory access efficiency, Linux has made a lot of careful design,
In addition to caching dentry (for VFS, accelerating file path name to inode conversion), two main cache methods are adopted: buffer cache and page cache. The former is used to read and write disk blocks, and the latter is used to read and write inode files. These caches can effectively shorten the time for I/O system calls (such as read, write, getdents.
Remember that the memory is used, not for reference. unlike windows, no matter how much physical memory you have, you need to read it from the hard disk swap file. this is why Windows often prompts insufficient virtual space. think about it,
It's boring. When there is a large amount of memory, some hard disk space is used as the memory. how is the hard disk faster than the memory. therefore, in Linux, as long as the swap space of swap is not used, we don't have to worry about having too little memory. if
Swap is used a lot. You may need to consider adding physical memory. This is also the Standard for Linux to check whether the memory is sufficient.