Linux viewing process occupied memory proc PID status

Source: Internet
Author: User
Tags current time

Command:cat/proc/9744/status  //9744 for process ID


Name:gedit/* Process's program name */
State:s (sleeping)/* Process status information */
tgid:9744/* Thread Group number */
pid:9744 * Process pid*/
PPi d:7672/* Parent process pid*/
tracerpid:0/* Tracking process pid*/
uid:1000    1000    1000     1000/*uid euid suid fsuid*/
gid:1000    1000    1000    1000/*gid egid sgid fsgid*/
fdsize:256 * Maximum number of file descriptors, file->fds*/
groups:0 4 20 24 25 29 30 44 46 107 109 115 124 1000/* id*/of the group to which the user who started the process is
vmpeak:60184 KB/* Process address space size */
vmsize:60180 KB/* Process virtual address space size Reserved_ VM: The size of the physical memory that the process has locked for the physical page */
vmlck:0 KB/* That the process is in reserve or special memory. Locked physical memory cannot be swapped to hard disk */
vmhwm:18020 KB/* File memory mapping and anonymous memory map size */
vmrss:18020 KB/* The size of the physical memory that the application is using is the value of the PS command's parameter RSS (RSS) */
vmdata:12240 KB/* Program Data segment Size (the size of the virtual memory), storing the initialized data */
vmstk:84 KB/* Process in user-state stack size */
vmexe:576 KB//program owned executable virtual memory size, code snippets, excluding tasks used by the library */
vmlib:21072 KB */The large library of virtual memory space that is imaged to the task Small */
vmpte:56 KB * * The size of all page tables for this process */
threads:1/* Share makesNumber of tasks with this signal descriptor */
sigq:0/8183/* Number of signals to be processed/current maximum number of signals to be processed */
sigpnd:0000000000000000/* Shielding bit, storing the thread's pending signal */
shdpnd:0000000000000000/* Shielding bit, storing the pending signal of the thread group */
sigblk:0000000000000000/* Storing blocked signals */
sigign:0000000000001000 /* Storing ignored signals */
sigcgt:0000000180000000/* Storing captured signals */
capinh:0000000000000000/* Ability to inherit from programs executed by the current process */
CAPPRM : 0000000000000000/* The capabilities that the process can use can contain capabilities that are not available in Capeff, which are temporarily discarded by the process themselves */
capeff:0000000000000000/* is a subset of CAPPRM, Process waiver not necessary to improve security */
cpus_allowed:01/* Can execute the process's CPU mask set */
Mems_allowed:1/**/
Voluntary_ctxt_switches: 1241/* Number of active transitions */
nonvoluntary_ctxt_switches:717/* Process Passive Toggle number */

Attach another article

1.top
Top-b-N 1 |grep opera|awk ' {print ' CPU: ' $ '% ', mem: ' $ '% '} '
cpu:0.0% mem:26.4%


2. PS aux
which

The RSS-------------process actually occupies the physical memory size;

VSZ--------------the size of the task virtual address space

Www.111Cn.net
3./proc/pid/status
[root@localhost ~]# cat/proc/self/status
Name:cat
State:r ( Running)
sleepavg:88%
tgid:5783
pid:5783
ppid:5742
tracerpid:0
uid:0 0 0 0
gid:0 0 0 0< br> fdsize:256
groups:0 1 2 3 4 6
vmsize:6588 KB
vmlck:0 KB
vmrss:400 KB
vmdata:144 KB
Vm stk:2040 KB
vmexe:14 KB
vmlib:1250 KB
stabrk:0804e000 KB
brk:088df000 KB
stastk:bfe03270 KB
execlim:0804c000
threads:1
sigpnd:0000000000000000
shdpnd:0000000000000000
sigblk:0000000000000000
sigign:0000000000000000
sigcgt:0000000000000000
capinh:0000000000000000
Capprm:00000000fffffeff
Capeff:00000000fffffeff

The


output interprets the name of the
parameter interpretation
Name application or command
State task, the average wait time (in nanosecond) for the Run/sleep/zombie/
Sleepavg task. Interactive tasks because of the number of hibernate, the length of time, their sleep_avg
will be correspondingly larger, so the calculated priority will also be higher.
Tgid Thread Group number
Pid task ID
Ppid parent process ID
Tracerpid The ID number of the process that is tracking the process information
UID UID euid suid fsuid
Gid GID egid SGI D Fsgid The maximum number of
Fdsize file descriptors, File->fds
Groups the size of the
Vmsize (KB) Task virtual address space
(TOTAL_VM-RESERVED_VM), where Total_ VM is the size of the address space for the process, RESERVED_VM: the size of the physical memory that the process has locked in the physical page of a reservation or special memory
Vmlck (KB) task. Locked physical memory cannot be swapped to hard disk (LOCKED_VM)
Vmrss (KB) The size of the physical memory that the application is using, that is, the value of the PS command's parameter RSS (RSS)
Vmdata (KB) program data segment Size (the size of the virtual memory), Holds the initialized data, the size of the
(TOTAL_VM-SHARED_VM-STACK_VM)
Vmstk (KB) task in the user-state stack (STACK_VM)
Vmexe (KB) program has executable virtual memory size, code snippets , excluding the library used by the task (End_code-start_code)
Vmlib (KB) is imaged to the virtual memory space of the task (Exec_lib)
Vmpte the size of all page tables for the process, in kilobytes: KB
Threads Shares the number of tasks that use this signal descriptor, in a POSIX multi-line program application, where all threads in the thread group use the same signal descriptor.
Sigq The number of signals to be processed
SIGPND shielding bit, storing the thread's pending signal
SHDPND screen bit, storing the pending signal for the thread group
Sigblk storing blocked signals
Sigign storing ignored signals
SIGCGT store captured signals
Capinh inheritable, the ability to inherit from programs executed by the current process
CAPPRM
permitted, the ability that processes can use to include capabilities that are not available in Capeff, These abilities are temporarily discarded by the process itself, Capeff is a subset of CAPPRM, the process abandons the unnecessary ability to improve security
Capeff effective, the process's effective capability


Example 1
You can see that the body segment (1KB) of the application is small, and that the code is minimal, relying on the library (1251KB) for execution. Stack (138KB) is moderate, indicating that there are not too many nested functions or particularly large number of temporary variables. Vmlck 0 indicates that the process does not lock any pages. Vmrss indicates that the current process uses a 2956KB of physical memory. When the process begins to use the memory that has already been requested but has not been used, the value of the vmrss begins to grow, but the vmsize remains unchanged.
[Root@localhost 1]# Cat/proc/4668/status
Name:gam_server
State:s (sleeping)
sleepavg:88%
tgid:31999
pid:31999
Ppid:1
tracerpid:0
uid:0 0 0 0
gid:0 0 0 0
fdsize:256
groups:0 1 2 3 4 6 10
vmsize:2136 KB
vmlck:0 KB
vmrss:920 KB
vmdata:148 KB
vmstk:88 KB
Vmexe:44 KB
vmlib:1820 KB
Vmpte:20 KB
Threads:1
sigq:1/2047
sigpnd:0000000000000000
shdpnd:0000000000000000
sigblk:0000000000000000
sigign:0000000000001006
sigcgt:0000000210000800
capinh:0000000000000000
Capprm:00000000fffffeff
Capeff:00000000fffffeff
[Root@localhost 31999] #4/PROC//STATM

Www.111cn.net
Contains all CPU-active information, all values in the file are accumulated from the start of the system to the current time.

[Root@localhost ~]# CAT/PROC/SELF/STATM
654 57 44 0 0 334 0

Here is my own understanding:

From the above we can see that Vmrss is our most concerned about the size of memory, that is

The size of the physical memory being used;

The vmsize is the size of the virtual space owned by the process;

"When the process starts to use the memory that has been requested but is not used,

The value of the vmrss begins to grow, but the vmsize remains unchanged. ”

We see that many of the values in memory are larger than the total size of the memory

Because it shows the size of virtual memory, not the actual size of the occupied;


This is the explanation of the other place.

From CAT/PROC/4743/STATM
611450 185001 883 18 0 593431 0

1. Size:-Total program size (611450 X 4096/1024 = 2445800kB = 2388M)
2. Resident:-resident set Size (185001 X 4096/1024 = 740004kB = 722M)
3. Share:-Shared pages (883 X 4096 = 3532)
4. TRS:-Text (code) (X 4096/1024 = 72kB = Vmexe)
5. DRS:-Data/stack
6. LRS:-Library (593431 X 4096/1024 = 2373724kB = Vmdata +vmstk)
7. DT:-Dirty pages


From here you can see that the first item is the executable size of the process, X4 equals vmsize

And the value of the second item is X4 equal to Vmrss

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.