English 中文(简体)
VmRSS和居民固定面积如何匹配?
原标题:How do VmRSS and resident set size match?
  • 时间:2012-05-01 16:22:02
  •  标签:
  • linux
  • procfs

I parse data from /proc/[pid]/statm to have a clue about memory use of a certain process. man proc表示, Resident set amount(在网页上测量)与VmRSS (KB?)在/proc/[pid]/status上相同。 由于这些价值观不同,我想理解这些价值观之间的联系。 是否有象一个因素一样,我可以在<代码>/proc上读到某些地方。 (我对VmPTE的想法,但深思。) 否则? 我应让哪一方为某种过程分配旧记忆的大小?

#ex 1782 = firefox

~$ cat /proc/1782/statm
  224621 46703 9317 11 0 98637 0
#          --- resident set size

~$ cat /proc/1782/status | grep Vm
  VmPeak:     935584 kB
  VmSize:     898484 kB
  VmLck:           0 kB
  VmHWM:      257608 kB
  VmRSS:      186812 kB
  VmData:     394328 kB
  VmStk:         220 kB
  VmExe:          44 kB
  VmLib:       61544 kB
  VmPTE:        1224 kB
  VmSwap:          0 kB
最佳回答

我的理解是,考试和测验是虚拟记忆的数量,而RSS是多少记忆中的居民。 因此,

虚拟记忆 = 部分实物记忆+部分磁盘

身体记忆的一部分是RSS。 因此,特别安全局应当大于RSS。 如果他们接近平等,这意味着你的工作是令人欣慰的记忆。 如果安全局的规模大得多,这意味着有足够的记忆,必须将其部分转移到磁盘上(即由于竞争过程等)。

在我的系统中,我可以做一个“man proc”,并列出如下内容:

          * VmPeak: Peak virtual memory size.

          * VmSize: Virtual memory size.

          * VmLck: Locked memory size (see mlock(3)).

          * VmHWM: Peak resident set size ("high water mark").

          * VmRSS: Resident set size.

          * VmData, VmStk, VmExe: Size of data, stack, and text segments.

如果你想要报告顶峰的记忆使用,那么你可能希望像万Peak这样的虚拟记忆。

希望这一帮助!

问题回答

www.un.org/Depts/DGACM/index_chinese.htm

阁下:46703 * 4kB(页数)=186812千B。

曼网页proc states in statm A. 背景

/proc/[pid]/statm  
 Provides information about memory usage, measured in pages.  The columns are:  

  size       (1) total program size  
             (same as VmSize in /proc/[pid]/status)  
  resident   (2) resident set size  
             (same as VmRSS in /proc/[pid]/status)  
  share      (3) shared pages (i.e., backed by a file)  
  text       (4) text (code)  
  lib        (5) library (unused in Linux 2.6)  
  data       (6) data + stack  
  dt         (7) dirty pages (unused in Linux 2.6)  

但未能说明的是,<代码>size和 居民以页数表示。

~$ cat /proc/1782/statm
  224621 46703 9317 11 0 98637 0
#          --- resident set size

因此,46703是页数表示的固定尺寸,224621也是页数表示的虚拟记忆。

现在,在KB中,他们用Size页乘。 页: 1 方案,电话:sysconf(_SC_PAGE_SIZE)(在未经编辑的情况下界定)。 这将使你有页数。 将其与1024年分开,以便在KB实现页数。

例:

$getconf PAGESIZE
4096

4096/1024 = 4 KB

Thus, resident set size in KB is 46703 x 4 = 186812 kB (VmRSS).
Total Program size in KB is 224621 x 4 = 898484 kB (VmSize)





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签