Linux idle memory Query

Source: Internet
Author: User

The basic principle of Linux is that no resources should be wasted. therefore, the core uses as much RAM as possible to cache information from local and remote file systems. when the system performs read/write operations, data related to the currently running process is stored in Ram as much as possible.Cache of system reportsYesCache and page CacheThe sum of the two. the cache is not recycled at the end of the process (You may soon start another process and need the same data), but recycled as needed-for example, when you start a process that requires a large amount of memory, the Linux core recycles the cache from the memory and allocates the obtained memory to the new process.

Some regions, such as anonymous memory ing (MMP s) And shared memory areas, they are reported as cache, but not directly released by the core. the general cache does not map to the address space of the process, but is just a simple core ing, and these special caches map to all processes attached to them.

So what you see when you run the TOP Command

Tasks: 330 total, 3 running, 327 sleeping, 0 stopped, 0 zombie
CPU (s): 13.4% us, 6.3% Sy, 0.0% Ni, 79.0% ID, 0.7% wa, 0.7% hi, 0.0% s
Mem: 2066800 k total, 1962740 K used, 104060 K free, 50828 K Buffers
Swap: 2097136 k total, 960 K used, 2096176 K free, 1349532 K cached

PID user PR Ni virt res shr s % CPU % mem time + command
6921 my_ SQL 15 0 131 M 20 m 5244 s 27 1.0 244: 57.46 mysqld
18665 vhost 15 0 24980 10 m 3588 S 3 0.5. 34 httpd
19878 vhost 16 0 25800 11 m 3584 S 3 0.6. 10 httpd
19900 vhost 15 0 24884 10 m 3584 S 1 0.5. 03 httpd

Mem: 2066800 k total, 1962740 K used, does not mean that your application has used 1.9g memory, which includes: for application memory + buffer + cache memory, you need to use the free command to view.

The following is an example (unit: MB ):

# Free-m

Total used free shared buffers cached
Mem: 2018 1927 91 0 45 1293
-/+ Buffers/cache: 588 1430
Swap: 2047 0 2047

In this example, the application only uses MB of memory and MB of idle memory.

Some simple calculation methods:

Physical memory used = actual memory used-buffer-Cache

= 1927 MB-45 m-1293 m

Physical idle memory = total physical memory-actually used memory + buffer + Cache

Available idle memory for applications = total physical memory-actually used memory

Application memory used = actual memory used-buffer-Cache


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.