Linux memory usage

Source: Internet
Author: User

Linux memory usage details command: free-m (-m means M bytes to display the content) total used free shared buffers cachedMem: 1002 769 232 0 62 421-/+ buffers/cache: 286 715 Swap: 1153 0 1153 www.2cto.com Part 1 Mem row: total memory: 1002 Mused memory used: 769 Mfree idle memory: 232 Mshared memory is not used up currently, always 0 buffers Buffer cache memory: 62 Mcached Page cache memory: 421 M relationship: total (1002 M) = used (769 M) + free (232 M) Second part (-/+ buffers/cache) :(-buffers/cache) used memory: 286 M (refers to the us in the first part of the Mem row Ed-buffers-cached) (+ buffers/cache) free memory size: 715 MB (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 of www.2cto.com refers to swap partitions. I think you are still dizzy after reading the above. why is used and free so strange in the results of the first part (Mem) and the second part (-/+ buffers/cache. in fact, we can explain it in two ways. it is the Mem parameter for the operating system. buffers/cached are both 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 elaborate designs, in addition to caching dentry (for VFS, accelerating file path name conversion 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 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 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. in addition, you can use the top command to dynamically view the list of processes with the most memory, CPU, and resources.

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.