Linux free command details-memory is used

Source: Internet
Author: User
Article Title: Linux free command details-memory is used. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

I told a friend that I have been using linux. he asked me why I use such high memory in linux. he told us that his 1g internal free is M. windows xp only uses MB.

Actually, the linux memory is very informative.
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)

It can be seen that-buffers/cache reflects the memory actually eaten by the program, while + 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,It is dominated by free and used of (-/+ buffers/cache. 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 elaborate designs, in addition to caching dentry (for VFS, accelerating the conversion of file path names to inode ), two major Cache methods are also 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 here. 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 still a large amount of memory, you can use some hard disk space to act 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 many swap instances are used, you may need to add physical memory. this is also the Standard for linux to check whether the memory is sufficient.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.