• Linux command -- free


    ref:

    http://www.linfo.org/free.html

    https://www.cnblogs.com/coldplayerest/archive/2010/02/20/1669949.html

                 total       used       free     shared    buffers     cached
    Mem:          3951       3807        144          0          0         18
    -/+ buffers/cache:       3789        162
    Swap:         4095       2302       1793

    Memory consists of mainly of random access memory (RAM) chips that have been built into multi-chip modules that are, in turn, plugged into slots on the motherboard (i.e., the main circuit board on a personal computer or workstation).

    Swap space is is a portion of a hard disk drive (HDD) that is used to simulate additional main memory (i.e., which is used for virtual memory).

    The first row, labeled Mem, displays physical memory utilization, including the amount of memory allocated to buffers and caches. A buffer, also called buffer memory, is usually defined as a portion of memory that is set aside as a temporary holding place for data that is being sent to or received from an external device, such as a HDD, keyboard, printer or network.

    The second line of data, which begins with -/+ buffers/cache, shows the amount of physical memory currently devoted to system buffer cache. This is particularly meaningful with regard to application programs, as all data accessed from files on the system that are performed through the use of read() and write() system calls1pass through this cache. This cache can greatly speed up access to data by reducing or eliminating the need to read from or write to the HDD or other disk.

    因为被系统cache和buffer占用的内存可以被快速回收,所以通常FO[3][3](buffer/cache free)比FO[2][3](mem free)会大很多。

    The third row, which begins with Swap, shows the total swap space as well as how much of it is currently in use and how much is still available.

    关于shared:

    表示被几个进程共享的内存的,现在已经deprecated,其值总是0(当然在一些系统上也可能不是0,主要取决于free命令是怎么实现的)

    关于cache:

    Linux和其他成熟的操作系统(例如windows),为了提高IO read的性能,总是要多cache一些数据,这也就是为什么FO[2][6](cached memory)比较大,而FO[2][3](free)比较小的原因。

    free will report slightly less memory as being in a computer than the actual total. This is mostly because the kernel (i.e., the core of the operating system) cannot be swapped out (i.e., the kernel always remains in main memory while the computer is in operation), and thus the memory that it occupies can never be freed.

    This command can be made even more useful by using watch's -d (i.e., difference) option, which highlights changes in output, and its -n option followed by the number one to increase the frequency of reports to one per second as follows:

    watch -n 1 -d free

    free命令由procps.*.rpm提供(在Redhat系列的OS上)。free命令的所有输出值都是从/proc/meminfo中读出的。

    difference between buffer and cache:

    A buffer is something that has yet to be "written" to disk. 

    A cache is something that has been "read" from the disk and stored for later use.

  • 相关阅读:
    按enter执行click或者搜索问题
    网络搜集-获取文件大小
    js获取文件大小
    JQuery UI Autocomplete与jquery.autocomplete.js
    如何在 IIS 中设置 HTTPS 服务
    什么是大数据(二)—涉及行业
    什么是大数据(一)
    未能加载文件或程序集“ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=n
    安装数据库出现错误vc_red.msi找不到
    网页兼容性注意事项
  • 原文地址:https://www.cnblogs.com/geeklove01/p/9226118.html
Copyright © 2020-2023  润新知