简体   繁体   English

linux显示进程ram的用法

[英]linux show process ram usage

free shows that My centos system used 4/11 Gb RAM, but I can't pinpoint which process has used them. free显示我的centos系统使用了4/11 Gb RAM,但是我无法确定哪个进程使用了​​它们。 I used top, however it only shows one process(mysqld) used about 1GB. 我使用了top,但是它仅显示一个使用了大约1GB的进程(mysqld)。 what's going on? 这是怎么回事?

# free -g
             total       used       free     shared    buffers     cached
Mem:            11          4          7          0          0          3
-/+ buffers/cache:          0         11
Swap:            1          0          1

sks:  91 total,   1 running,  90 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.1%sy,  0.0%ni, 99.9%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  12299928k total,  4372572k used,  7927356k free,    77392k buffers
Swap:  2097144k total,        0k used,  2097144k free,  3925252k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 18 0 10352 704 588 S 0.0 0.0 0:00.82 init
2 root RT -5 0 0 0 S 0.0 0.0 0:00.01 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
4 root RT -5 0 0 0 S 0.0 0.0 0:00.01 migration/1
5 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/1
6 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/2
7 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/2
8 root RT -5 0 0 0 S 0.0 0.0 0:00.00 migration/3
9 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/3
10 root 10 -5 0 0 0 S 0.0 0.0 0:00.09 events/0
11 root 10 -5 0 0 0 S 0.0 0.0 0:00.01 events/1
12 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/2
13 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/3
14 root 10 -5 0 0 0 S 0.0 0.0 0:00.01 khelper
119 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
126 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kblockd/0
127 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kblockd/1
128 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kblockd/2
129 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kblockd/3
130 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid
292 root 14 -5 0 0 0 S 0.0 0.0 0:00.00 cqueue/0
293 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 cqueue/1
294 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 cqueue/2
295 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 cqueue/3
298 root 14 -5 0 0 0 S 0.0 0.0 0:00.00 khubd
300 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kseriod
390 root 15 0 0 0 0 S 0.0 0.0 0:00.00 khungtaskd
393 root 17 -5 0 0 0 S 0.0 0.0 0:00.00 kswapd0
394 root 17 -5 0 0 0 S 0.0 0.0 0:00.00 aio/0
395 root 18 -5 0 0 0 S 0.0 0.0 0:00.00 aio/1
396 root 18 -5 0 0 0 S 0.0 0.0 0:00.00 aio/2
397 root 17 -5 0 0 0 S 0.0 0.0 0:00.00 aio/3
603 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kpsmoused
671 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 mpt_poll_0
672 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 mpt/0
673 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 scsi_eh_0
679 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 ata/0
680 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 ata/1
681 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 ata/2
682 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 ata/3
683 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 ata_aux
694 root 14 -5 0 0 0 S 0.0 0.0 0:00.00 kstriped
715 root 15 -5 0 0 0 S 0.0 0.0 0:00.00 ksnapd
753 root 10 -5 0 0 0 S 0.0 0.0 0:03.54 kjournald
778 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kauditd
811 root 19 -4 12668 836 400 S 0.0 0.0 0:00.53 udevd
2331 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kmpathd/0
2332 root 12 -5 0 0 0 S 0.0 0.0 0:00.00 kmpathd/1
2334 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 kmpathd/2
2335 root 13 -5 0 0 0 S 0.0 0.0 0:00.00 kmpathd/3
2336 root 12 -5 0 0 0 S 0.0 0.0 0:00.00 kmpath_handlerd
2358 root 11 -5 0 0 0 S 0.0 0.0 0:00.00 kjournald
2899 root 15 0 0 0 0 S 0.0 0.0 0:00.00 vmmemctl
3028 root 15 0 17540 1292 1052 S 0.0 0.0 0:01.31 vmware-guestd
3374 root 11 -4 28220 816 584 S 0.0 0.0 0:00.02 auditd
3376 root 7 -8 16268 764 620 S 0.0 0.0 0:00.01 audispd
3396 root 15 0 5912 672 544 S 0.0 0.0 0:00.06 syslogd
3399 root 15 0 3808 428 348 S 0.0 0.0 0:00.01 klogd
3413 root 18 0 10764 372 244 S 0.0 0.0 0:00.29 irqbalance
3428 dbus 18 0 32712 1404 856 S 0.0 0.0 0:00.00 dbus-daemon

3477 haldaemo 15 0 49164 5152 2224 S 0.0 0.0 0:00.91 hald
3478 root 15 0 21700 1056 872 S 0.0 0.0 0:00.01 hald-runner
3485 haldaemo 19 0 12328 860 744 S 0.0 0.0 0:00.00 hald-addon-acpi
3491 haldaemo 17 0 12328 852 740 S 0.0 0.0 0:00.00 hald-addon-keyb
3500 root 16 0 10232 688 592 S 0.0 0.0 0:02.94 hald-addon-stor
3519 nscd 15 0 199m 2044 1364 S 0.0 0.0 0:00.15 nscd
3542 root 15 0 60748 1196 648 S 0.0 0.0 0:00.00 sshd
3561 ntp 15 0 19832 5528 4424 S 0.0 0.0 0:00.03 ntpd
3576 root 25 0 64168 1320 1056 S 0.0 0.0 0:00.19 mysqld_safe
3601 root 15 0 73812 1052 492 S 0.0 0.0 0:00.01 crond
3714 xfs 18 0 18416 744 480 S 0.0 0.0 0:00.00 xfs
3799 root 18 0 17068 448 304 S 0.0 0.0 0:00.00 atd
3923 root 25 0 58876 316 240 S 0.0 0.0 0:00.00 rhnsd
3942 root 17 0 3796 492 420 S 0.0 0.0 0:00.00 mingetty
3945 root 15 0 3796 488 420 S 0.0 0.0 0:00.00 mingetty
3948 root 18 0 3796 488 416 S 0.0 0.0 0:00.00 mingetty
3950 root 18 0 3796 488 416 S 0.0 0.0 0:00.00 mingetty
3951 root 18 0 3796 484 416 S 0.0 0.0 0:00.00 mingetty
3956 root 18 0 3796 488 416 S 0.0 0.0 0:00.00 mingetty

  1. You can sort the processes by used memory by pressing M when in top. 您可以通过按顶部的M来按使用的内存对进程进行排序。
  2. Linux uses unused memory as a disk cache, it's normal behavior. Linux使用未使用的内存作为磁盘缓存,这是正常现象。

ps has options for this. ps为此提供了选项。

eg ps -euf 例如ps -euf

or 要么

ps -e -orss=,size=,args= | sort -b -n

rss resident set size size rss常驻集大小大小
size memory size in kilobytes 大小内存大小(以千字节为单位)

gnome-system-monitor以可视方式表示进程,当前使用的CPU,ID和内存的百分比。

If you want a more visual (yet command line) tool, htop would be a good idea. 如果您想要一个更直观的工具(但仍是命令行),则htop将是一个好主意。 You can sort them by various options. 您可以按各种选项对它们进行排序。

阅读free ,有3GB用作磁盘缓存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM