Linux proc Process information detailed __linux

Source: Internet
Author: User
Tags anonymous locale
/proc//maps
View how the virtual address space of the process is used.
The file has 6 columns, respectively:
Address: library in process address range
Permissions: Virtual memory permissions, r= read, w= write, x=,s= share, p= private;
Offset: library in process address range
Equipment: Image file of the main equipment number and the secondary device number;
Node: the node number of the image file;
Paths: Paths to image files
Each item corresponds to a VM_AREA_STRUCT structure member,
Example:
The body segment of the application (permissions are R-XP) from 0x08048000 to 0x08049000, size 4096, data segment from 0x08049000 to 0x0804a000, size 1KB. The application uses two libraries: Lib and libc. The LIBC body segment is from 0x00391000 to 0x004b4000, the size is 1164KB, the data segment is from 0x004b5000 to 0x004b8000, and the size is 12KB.
The body section of Ld is from 00378000 to 0038d000, the size is 84KB, the data segment is from 0x0038e000 to 0x0038f000, and the size is 4KB. The size of the virtual space used by the application is from 0x4b8000 to 0x378000, the size is 1280KB, but the actual size is Vmlib (1251KB), because it is allocated by page, each page size is 4KB.

[Root@localhost ~]# Cat/proc/7114/maps
08047000-080dc000 R-xp 00000000 03:06 884901/bin/bash
080dc000-080e3000 rwxp 00094000 03:06 884901/bin/bash
080e3000-08129000 rwxp 080e3000 00:00 0 [Heap]
4d575000-4d58a000 R-xp 00000000 03:06 736549/lib/ld-2.3.4.so
4d58a000-4d58b000 r-xp 00015000 03:06 736549/lib/ld-2.3.4.so
4d58b000-4d58c000 rwxp 00016000 03:06 736549/lib/ld-2.3.4.so
4d58e000-4d6b1000 R-xp 00000000 03:06 736550/lib/tls/libc-2.3.4.so
4d6b1000-4d6b2000 r-xp 00123000 03:06 736550/lib/tls/libc-2.3.4.so
4d6b2000-4d6b5000 rwxp 00124000 03:06 736550/lib/tls/libc-2.3.4.so
4d6b5000-4d6b7000 Rwxp 4d6b5000 00:00 0
4d6de000-4d6e0000 R-xp 00000000 03:06 736552/lib/libdl-2.3.4.so
4d6e0000-4d6e2000 rwxp 00001000 03:06 736552/lib/libdl-2.3.4.so
4d807000-4d80a000 R-xp 00000000 03:06 736567/lib/libtermcap.so.2.0.8
4d80a000-4d80b000 rwxp 00002000 03:06 736567/lib/libtermcap.so.2.0.8
b7bf2000-b7c1e000 R-xp 00000000 03:06 881337/usr/lib/gconv/gb18030.so
b7c1e000-b7c20000 rwxp 0002b000 03:06 881337/usr/lib/gconv/gb18030.so
b7c20000-b7c26000 R-xs 00000000 03:06 881502/usr/lib/gconv/gconv-modules.cache
b7c26000-b7d2f000 r-xp 02197000 03:06 852489/usr/lib/locale/locale-archive
b7d2f000-b7f2f000 R-xp 00000000 03:06 852489/usr/lib/locale/locale-archive
b7f2f000-b7f38000 R-xp 00000000 03:06 734450/lib/libnss_files-2.3.4.so
b7f38000-b7f3a000 rwxp 00008000 03:06 734450/lib/libnss_files-2.3.4.so
b7f3a000-b7f3c000 Rwxp b7f3a000 00:00 0
b7f51000-b7f52000 Rwxp b7f51000 00:00 0
bfc3d000-bfc52000 rw-p bfc3d000 00:00 0 [Stack]
ffffe000-fffff000---P 00000000 00:00 0 [VDSO]
[Root@localhost ~]#

Parameter explanation
address:0085d000-00872000 The address space of the starting and ending address files for the virtual memory area
Perms:rw-p permissions: R=read, W=write, X=execute, s=shared, p=private (copy on Write)
offset:00000000 The offset of the virtual memory region in the mapped file
dev:03:08 number and minor number of the primary device
Inode: Device Node number 0 means no node corresponds to memory
Name:/lib/ld-2.3.4.so The filename of the mapped file

The code snippet of each shared library, storing binary executable machine instruction, is a map of the code section of the elf file of the library to the virtual storage space by kernel;
The data segment of each shared library, which holds the global variables required for program execution, is composed of the kernel data segment map to the virtual storage space;
User code snippet, storing binary form executable machine instruction, is by kernel the elf file code segment map to virtual storage space;
The user data segment is a code segment, which holds the global variables required for program execution, and is composed of the data segment map of the Elf file to the virtual storage space by kernel;
Under the user data segment is the heap (heap), when and only when the malloc call exists, is by kernel the anonymous memory map to the virtual storage space, the heap in the program does not call the malloc case does not exist;
Under the user data segment is stack (stack), as the temporary data area of the process, is by kernel the anonymous memory map to the virtual storage space, the growth direction of stack space from high address to low address.

[Root@localhost ~]# Ldd/bin/bash
Linux-gate.so.1 => (0xffffe000)
Libtermcap.so.2 => /lib/libtermcap.so.2 (0x4d807000)
Libdl.so.2 => /lib/libdl.so.2 (0x4d6de000)
Libc.so.6 => /lib/tls/libc.so.6 (0x4d58e000)
/lib/ld-linux.so.2 (0x4d575000)
[Root@localhost ~]#

This so-called "linux-gate.so.1" content is the kernel mapping code, the system does not exist in fact such a link library file, its name is by LDD itself, the 0xffffe400 here a piece of code, Here is the system call entry code that the kernel maps for us. Mapped is the size of the application's virtual space, where the value is 4KB larger than the top or PS, and the last 0XFFFFE400-0XFFFFFFFF code; shared gives the shared part of the virtual space.

2/proc//stat
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/6873/stat
6873 (a.out) R 6723 6873 6723 34819 6873 8388608 77 0 0 0 41958 31 0 0 25 0 3 0 5882654 1409024 56 4294967295 134512640 13 4513720 3215579040 0 2097798 0 0 0 0 0 0 0 0 0 0 [root@localhost ~]#


The meaning of each parameter is:
Parameter explanation
pid=6873 process (including lightweight process, that is, thread) number
Comm=a.out the name of an application or command
Task_state=r the status of the task, R:runnign, s:sleeping (task_interruptible), D:disk Sleep (task_uninterruptible), t:stopped, T: Tracing Stop,z:zombie, X:dead
ppid=6723 Parent Process ID
pgid=6873 Thread Group number
sid=6723 c the session group ID for this task
tty_nr=34819 (PTS/3) The device number of the TTY terminal for the task, INT (34817/256) = main device number, (34817-Main device number) = Secondary device number
tty_pgrp=6873 the process group number of the terminal, the PID of the foreground task (including the shell application) that is currently running on the terminal where the task resides.
task->flags=8388608 process flag bit to view the attributes of the task
Min_flt=77 This task does not need to copy data from the hard disk to the number of page faults (secondary pages)
Cmin_flt=0 cumulative the number of times that all waited-for processes of the task have occurred
Maj_flt=0 the number of page faults (master pages) that the task needs to copy data from the hard disk
Cmaj_flt=0 cumulative the task of all the waited-for processes that have occurred the number of main page faults
utime=1587 the time the task is running in user state, in jiffies
Stime=1 the task in the nuclear mentality of the time of operation, Unit for Jiffies
Cutime=0 cumulative the task of all the waited-for processes that once ran in the user state of time, in units of jiffies
Cstime=0 cumulative the task of all the waited-for processes that had ever run in the nuclear mentality of the time, Unit for Jiffies
Dynamic priority of priority=25 tasks
Static priority for nice=0 tasks
Num_threads=3 the number of threads in the thread group where the task is located
It_realvalue=0 the delay of the next SIGALRM send process due to the timing interval, in Jiffy.
start_time=5882654 the time the task was started, in units of jiffies
vsize=1409024 (page) The virtual address space size of this task
RSS=56 (page) The size of this task currently resides in the Physical address space
Number of pages The process has in real Memory,minu 3 for administrative purpose.
These pages may be used for code, data, and stacks.
rlim=4294967295 (bytes) This task can host the maximum value of the physical address space
start_code=134512640 The starting address of the code snippet for this task in the virtual address space
end_code=134513720 the end address of the code snippet for this task in the virtual address space
start_stack=3215579040 the end address of the stack for this task in the virtual address space
The current value of the Kstkesp=0 ESP (32-bit stack pointer) is consistent with the kernel stack page of the process.
kstkeip=2097798 A pointer to the instruction that will be executed, the current value of the EIP (32-bit instruction pointer).
Pendingsig=0 the bitmap of the signal to be processed, recording the normal signal sent to the process
Bitmap of block_sig=0 blocking signal
Bitmap of the sigign=0 ignored signal
Bitmap of the sigcatch=082985 captured signal
Wchan=0 If the process is a sleep state, this value gives the call point of the Dispatch
The number of pages Nswap by swapped is currently useless
Cnswap the number of pages that are swapped by all child processes, and is currently useless
Exit_signal=17 the signal sent to the parent process at the end of the process
Which CPU the TASK_CPU (Task) =0 is running on
Task_rt_priority=0 the relative priority level of real-time processes
task_policy=0 process scheduling strategy, 0 = non-real-time process, 1=fifo real-time process; 2=RR real-time process

3/proc//status
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/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
fdsize:256
groups:0 1 2 3 4 6 10
vmsize:6588 KB
vmlck:0 KB
vmrss:400 KB
vmdata:144 KB
vmstk: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


Output explanation
Parameter explanation
Name of the application or command
State task status, run/sleep/zombie/
The average wait time of the SLEEPAVG task (in nanosecond), the interactive task because of the number of hibernate, the time is long, 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 receiving the process information
UID UID euid suid fsuid
GID GID Egid sgid fsgid
Fdsize the maximum number of file descriptors, File->fds
Groups
Vmsize (KB) task virtual address space size (TOTAL_VM-RESERVED_VM), where TOTAL_VM is the size of the process's address space, RESERVED_VM: The process is in the physical page between reservations or special memory
The size of the physical memory that the VMLCK (KB) task has locked. Locked physical memory cannot be swapped to hard drive (LOCKED_VM)
Vmrss (KB) the size of the physical memory that the application is using is the value of the parameter RSS with the PS Command (RSS)
Vmdata (KB) program data segment Size (the size of the virtual memory), storing initialized data; (TOTAL_VM-SHARED_VM-STACK_VM)
VMSTK (KB) tasks in the user state stack size (STACK_VM)
Vmexe (KB) program has executable virtual memory size, code snippet, excluding the library used by the task (End_code-start_code)
Vmlib (KB) The size of the library that 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 a thread group use the same signal descriptor.
Number of SIGQ signal to be processed
SIGPND shielding bit, storing the thread's pending signal
SHDPND shielding bit, storing the pending signal of the thread group
Sigblk to store blocked signals
Sigign to store ignored signals
SIGCGT to store the captured signals.
Capinh inheritable, the ability to inherit from programs that are executed by the current process
CAPPRM permitted, the ability of a process to be able to use, can contain the ability that is not in Capeff, these abilities are temporarily abandoned by the process itself, Capeff is a subset of CAPPRM, the process abandons the necessary ability to improve security
Capeff effective, the effective ability of the process


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
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


Output explanation
CPU and CPU0 ... The meaning of each parameter (in the first act) of each row is:
Parameter Interpretation/proc//status
Size (pages) task virtual address space VMSIZE/4
The size of the physical memory that the resident (pages) application is using VMRSS/4
Shared (pages) share pages 0
The size of the executable virtual memory owned by the TRS (pages) program VMEXE/4
Lrs (pages) the size of the library that is imaged to the virtual memory space of the task VMLIB/4
Drs (pages) program data segment and user state stack size (vmdata+ VMSTK) 4
DT (pages) 0
4

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.