Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What does mem mean in linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the meaning of mem in linux, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

In linux, mem is physical memory; when physical memory is about to overflow, memory that is not commonly used in memory is transferred to SWAP until physical memory is free and SWAP's memory is active.

The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is mem in linux

Mem is physical memory. When physical memory is about to overflow, the memory that is not commonly used in memory will be transferred to SWAP until the physical memory is free and swap's memory is active.

Linux mem/swap/buffers/cached distinction

The free command provides a simpler view of system memory usage than top:

# free-m

Mem: represents physical memory statistics

Buff/cache: represents the cache statistics of physical memory

Swap: indicates the use of swapped partitions on the hard disk

The real memory currently available to the system is not marked by the first line of free, it only represents the unallocated memory

Buff/cache column occupies too high

What is the main purpose of buff/cache?

Linux has an advanced caching mechanism that caches dentry (for VFS- virtual file systems to accelerate file pathname to inode conversion), buffer cache (for disk block read and write), and page cache (for file inode read and write) to improve read and write efficiency. However, after a large number of file operations, the cache will basically use up the memory resources, although the file reading efficiency has been improved, but the physical memory will be gradually eaten up.

It turns out that the system has carried out frequent file read and write operations, but why the operating system will not take the initiative to reclaim it? it is because the default parameter of drop_caches is not released.

The value of drop_caches can be a number between 0 and 3, representing different meanings:

0: no release (system default)

1: release the page cache

2: release dentries and inode

3: release all caches

Modify:

# echo 1 > / proc/sys/vm/drop_caches

Interlude

When the physical memory of the Linux is about to be exhausted, the system will transfer the memory occupied by some processes to the swap area. When part of the physical memory is released, some of the memory occupation of the swap area will slowly return to the mem area, but the mem area is no longer the previous full load state, but a part of the free memory!

[summary]

1) when the physical memory is almost exhausted, the system does not crash, but uses swap as temporary memory. When both are exhausted, the system OutofMemory

2) the physical memory reaches its peak, and some uncommonly used process memory occupies are mentioned in the swap area.

3) when the resources in the Men area are released, not all the memory moved to the swap will come back, but will slowly return to the men area when the system or program wakes up.

4) swap is the virtual memory of the disk when there is not enough memory, and the disk is mainly operated at the Imax O level, not at the kernel level, and the processing speed is not at the same level as the mem area.

Thank you for reading this article carefully. I hope the article "what is the meaning of mem in linux" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report