What does rss mean in linux

藏色散人
藏色散人Original
2023-04-14 10:46:052518browse

RSS in Linux means resident memory set, and its full English name is "Resident Set Siz", which indicates the memory size allocated by the process; RSS does not include the memory entering the swap partition, including the memory occupied by the shared library , also includes all allocated stack memory and heap memory.

What does rss mean in linux

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

What does rss mean in Linux?

The meaning of RSS and VSZ in Linux memory management

RSS is the resident set size (Resident Set Size), indicating the memory size allocated by the process.

RSS does not include memory going into the swap partition.

RSS includes the memory occupied by the shared library (as long as the shared library is in memory)

RSS includes all allocated stack memory and heap memory.

VSZ represents the virtual memory allocated by the process.

VSZ includes all memory that the process can access, including what goes into the swap partition, and the memory occupied by shared libraries.

If a process has a program size of 500K, a linked shared library size of 2500K, and a total stack memory of 200K, 100K of which enters the swap partition.

The process actually loads 1000K content in the shared library and 400K content in its own program. What should the RSS and VSZ be?

RSS: 400K + 1000K + 100K = 1500K
VSZ: 500K + 2500K + 200K = 3200K

Part of RSS comes from shared libraries, and shared libraries may be used by many processes, so if the RSS of all processes are added up, it may be larger than the system memory.

There is a newer parameter PSS (proportional set size), which calculates shared memory differently from RSS. Referring to the previous example, if there are two processes using the same shared library, then:

PSS: 400K + (1000K/2) + 100K = 400K + 500K + 100K = 1000K

Threads share the same address space, so all threads within a process have the same RSS, VSZ and PSS. You can use the ps or top command to observe this information.

There is way more to it than this, to learn more check the following references:

Recommended study: "linux video tutorial"

The above is the detailed content of What does rss mean in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:what is linux epelNext article:what is linux epel