Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ The free command in Linux     - Simple and fast sorting (Programming)

- How to use Android Studio development / debugging Android source code (Linux)

- How to choose the first programming language based on the life you want (Programming)

- Linux system security check notes on performance (Linux)

- Use GLOBK batch command network adjustment (Linux)

- Moosefs Distributed File System Configuration (Server)

- Ubuntu 14.04, 13.10 install OpenCV 2.4.9 (Linux)

- CentOS7 install MySQL5.6.22 (Linux)

- To install the latest version of the EPEL on CentOS 5.x or 6.x (Linux)

- Java thread lifecycle (Programming)

- Eclipse, Tomcat configuration JNDI connection Oracle data source example (Server)

- installation of Vim plugin YouCompleteMe under Ubuntu 15.04 (Linux)

- Increase ssh security service under Linux (Linux)

- The hash function under OpenSSL (Linux)

- iOS GCD multithreading simple to use (Programming)

- Vim Getting Started Tutorial (Linux)

- Eclipse Android development environment installation (Linux)

- Save the database data files into Oracle Learning (Database)

- MySQL query performance comparison of a single truth (Database)

- ORA-12154: TNS: could not resolve the connect identifier specified solve (Database)

  The free command in Linux
  Add Date : 2017-08-31      
  Explain the output of the free command on Linux.

Here are the results of free operation, a total of four lines. For convenience, I added the column number. This free output can be seen as a two-dimensional array FO (Free Output). E.g:

FO [2] [1] = 15402628 FO [3] [2] = 12033012

Free output a total of four lines, the fourth exchange of information exchange, the total exchange (total), the use of (used) and the number of free exchange (free), the more clearly, not that much .

Free output to the second line and the third line is more confusing. These two lines are to illustrate the memory usage. The first column is total, the second column is used, and the third column is free.

The output of the first line is viewed from the operating system (OS). In other words, from the perspective of the OS, the computer a total of:

15402628KB (By default, the unit of free KB) physical memory, that FO [2] [1];

In these physical memory 15318812KB (ie FO [2] [2]) was used;

Also available is 83816KB (ie FO [2] [3]);

Here we get the first equation:

FO [2] [1] = FO [2] [2] + FO [2] [3]

FO [2] [4] means that the memory shared by several processes is now deprecated, and its value is always 0 (of course, in some systems may not be 0, mainly depends on how the free command is achieved).

FO [2] [5] Indicates the memory occupied by the OS buffer. FO [2] [6] represents the memory of the OS cache. In some cases buffer and cache these two words often mix. However, in some relatively low-level software is to distinguish between these two words, to see foreigners of the foreign language:

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.

In other words, buffer is used to store the output to the disk (block device) data, and cache is stored from the disk read data. Both are designed to improve IO performance and are managed by the OS.

Linux and other mature operating systems (such as Windows), in order to improve the performance of IO read, always want to cache some data, which is why FO [2] [6] (cached memory) [3] The reason for the smaller. We can do a simple test:

1. Released by the system cache occupied by the data;

Echo 3> / proc / sys / vm / drop_caches

2. Read a large file and record the time;

3. Close the file;

4. Re-read this large file and record the time;

The second reading should be much faster than the first. I had done a BerkeleyDB read operation, probably to read 5G file, tens of millions of records. In my environment, the second reading is about 9 times faster than the first.

The second line of free output is the use of system memory from the perspective of an application.

For FO [3] [2], that is, -buffers / cache, that an application that the system is used up much memory;

For FO [3] [3], that is, + buffers / cache, that an application that the system how much memory;

FO [3] [3] is usually much larger than FO [2] [3] because the memory occupied by the system cache and buffer can be quickly recovered.

There are two equations:

FO [3] [2] = FO [2] [2] - FO [2] [5]

FO [3] = FO [2] [3] + FO [2] [5] + FO [2] [6]

Both are not difficult to understand.

The free command is provided by procps. *. Rpm (on the OS of the RedHat family). All output of the free command is read from / proc / meminfo.

On the system may meminfo (2) this function, it is to resolve / proc / meminfo. Procps This package implements the meminfo () function. You can download a tarps procps look at the specific implementation, the latest version 3.2.8.
- Linux Log (Linux)
- Yii PHP Framework Getting Started tutorial (Linux)
- How to use the ftp tool to transfer files between Windows and Linux (Linux)
- Linux the best download manager uGet (Linux)
- Oracle 11g How dataguard master repository to Oracle single instance data recovery (Database)
- 10 really interesting Linux command (Linux)
- Elixir: the future of programming languages (Programming)
- Postfix mail service system principle and configuration (Linux)
- Comparison of Nginx and Nginx + (Server)
- Kibana Apache Password Authentication (Server)
- Java Foundation - The relationship between abstract classes and interfaces (Programming)
- 10 Regulation of painless SQL Schema (Database)
- Let OpenCV face detection score output codes (Programming)
- AngularJS notes --- Data Binding (Programming)
- Vim Common Command Summary (Linux)
- Linux distributed message queue RocketMQ deployment and monitoring - Dual Master (Server)
- Examples of safety testing system notes for RedHat Linux (Linux)
- RPM package management under Linux (Linux)
- independently configurable PHP environment under CentOS6.5 (Server)
- Linux Man Page Installation (Linux)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.