Analysis of STATM, maps, Memmap memory information files under Linux/proc

Source: Internet
Author: User

Ls/proc can see some digitally named folders, these numbers are pid[[email protected] proc]# CAT/PROC/1/STATM for the process
487 185 133 31 0 67 0

It is easy to return 7 sets of numbers, each of which is a page (common 4KB)
respectively is
Size: Task virtual address space
Resident: The size of the physical memory being used
Shared: Share pages
Trs: The size of executable virtual memory that the program has
Lrs: The size of the library of virtual memory space that is being imaged by the task
Drs: Size of program data segment and stack of user state
DT: Number of dirty pages


Now look at maps.
[Email protected] proc]# Cat/proc/1/maps
00110000-00111000 r-xp 00110000 00:00 0 [VDSO]
0032b000-00347000 R-xp 00000000 fd:00 852733/lib/ld-2.8.so
00347000-00348000 r--p 0001c000 fd:00 852733/lib/ld-2.8.so
00348000-00349000 rw-p 0001d000 fd:00 852733/lib/ld-2.8.so
0034b000-004ae000 R-xp 00000000 fd:00 852734/lib/libc-2.8.so
004ae000-004b0000 r--p 00163000 fd:00 852734/lib/libc-2.8.so
004b0000-004b1000 rw-p 00165000 fd:00 852734/lib/libc-2.8.so
004b1000-004b4000 rw-p 004b1000 00:00 0
08048000-08067000 R-xp 00000000 fd:00 843075/sbin/init
08067000-08068000 rw-p 0001e000 fd:00 843075/sbin/init
08b42000-08b6a000 rw-p 08b42000 00:00 0 [Heap]
b8046000-b8048000 rw-p b8046000 00:00 0
bfb4e000-bfb63000 rw-p bffeb000 00:00 0 [Stack]


A total of 6 columns
The first column represents the virtual address of the memory segment
The second column represents execute permissions, R,w,x Needless to say, p= private s= shared
Needless to say, heap and stack segments should not have X, otherwise it is easy to be XX, but this is related to the specific version
The third column represents the offset in the process address
The main device number and secondary device number of the fourth column mapping file
by cat/proc/devices
To know that FD is 253 device-mapper


The node number of the fifth column image file, which is the inode


The sixth column is the path to the image file
I used to wonder how there would be two identical file paths, originally
08048000-08067000 R-xp 00000000 fd:00 843075/sbin/init
08067000-08068000 rw-p 0001e000 fd:00 843075/sbin/init
One is read-only, is a code snippet, one is read-write, is a data segment
As for why a shared library is divided into three
0034b000-004ae000 R-xp 00000000 fd:00 852734/lib/libc-2.8.so
004ae000-004b0000 r--p 00163000 fd:00 852734/lib/libc-2.8.so
004b0000-004b1000 rw-p 00165000 fd:00 852734/lib/libc-2.8.so
One of the 004ae000-004b0000 r--p 00163000 fd:00 852734/lib/libc-2.8.so
Still don't understand.


Finally, look at the mysterious Memmap.
Unfortunately not all versions have this file, as I have here
The memmap need to look at maps with the words spoken.
Each of the displayed lines represents a segment in maps.
Each number in each row represents a page in that paragraph, how large the segment is, and how many numbers a line corresponds to.


If this number is 0, the system allocates virtual memory for it, but does not allocate physical memory
If there is a number, the system assigns it physical memory, and how many processes refer to the page
Of course, there will be no negative numbers.

Analysis of STATM, maps, Memmap memory information files under Linux/proc

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.