maps Memory maps to executables and library files

UNIX Parameter

$sudo cat /proc/1/maps
[sudo] password for jeffrin:
00400000-00409000 r-xp 00000000 08:01 6070276                            /sbin/init
00608000-00609000 r--p 00008000 08:01 6070276                            /sbin/init
00609000-0060a000 rw-p 00009000 08:01 6070276                            /sbin/init
01c21000-01c42000 rw-p 00000000 00:00 0                                  [heap]
7f641ff63000-7f641ff100000 r-xp 00000000 08:01 14532647                   /lib/x86_64-linux-gnu/libdl-2.13.so
7f641ff100000-7f64201100000 ---p 00002000 08:01 14532647                   /lib/x86_64-linux-gnu/libdl-2.13.so
7f64201100000-7f6420166000 r--p 00002000 08:01 14532647                   /lib/x86_64-linux-gnu/libdl-2.13.so
7f6420166000-7f6420167000 rw-p 00003000 08:01 14532647                   /lib/x86_64-linux-gnu/libdl-2.13.so
7f6420167000-7f64202e4000 r-xp 00000000 08:01 14532633                   /lib/x86_64-linux-gnu/libc-2.13.so
7f64202e4000-7f64204e4000 ---p 0017d000 08:01 14532633                   /lib/x86_64-linux-gnu/libc-2.13.so
7f64204e4000-7f64204e8000 r--p 0017d000 08:01 14532633                   /lib/x86_64-linux-gnu/libc-2.13.so
7f64204e8000-7f64204e9000 rw-p 00181000 08:01 14532633                   /lib/x86_64-linux-gnu/libc-2.13.so
7f64204e9000-7f64204ee000 rw-p 00000000 00:00 0
7f64204ee000-7f642050b000 r-xp 00000000 08:01 95764100                    /lib/x86_64-linux-gnu/libselinux.so.1
7f642050b000-7f642070b000 ---p 0001d000 08:01 95764100                    /lib/x86_64-linux-gnu/libselinux.so.1
7f642070b000-7f642070c000 r--p 0001d000 08:01 95764100                    /lib/x86_64-linux-gnu/libselinux.so.1
7f642070c000-7f642070d000 rw-p 0001e000 08:01 95764100                    /lib/x86_64-linux-gnu/libselinux.so.1
7f642070d000-7f642070e000 rw-p 00000000 00:00 0
7f642070e000-7f642074c000 r-xp 00000000 08:01 14401899                   /lib/x86_64-linux-gnu/libsepol.so.1
7f642074c000-7f642094c000 ---p 0003e000 08:01 14401899                   /lib/x86_64-linux-gnu/libsepol.so.1
7f642094c000-7f642094d000 rw-p 0003e000 08:01 14401899                   /lib/x86_64-linux-gnu/libsepol.so.1
7f642094d000-7f642096c000 r-xp 00000000 08:01 14532660                   /lib/x86_64-linux-gnu/ld-2.13.so
7f6420b44000-7f6420b48000 rw-p 00000000 00:00 0
7f6420b6a000-7f6420b6c000 rw-p 00000000 00:00 0
7f6420b6c000-7f6420b6d000 r--p 0001f000 08:01 14532660                   /lib/x86_64-linux-gnu/ld-2.13.so
7f6420b6d000-7f6420b6e000 rw-p 00020000 08:01 14532660                   /lib/x86_64-linux-gnu/ld-2.13.so
7f6420b6e000-7f6420b6f000 rw-p 00000000 00:00 0
7fffa543c000-7fffa545d000 rw-p 00000000 00:00 0                          [stack]
7fffa55ff000-7fffa5600000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

Parameter Definition

The /proc/PID/maps file containing the currently mapped memory regions and
their access permissions.


where "address" is the address space in the process that it occupies, "perms"
is a set of permissions:

 r = read
 w = write
 x = execute
 s = shared
 p = private (copy on write)

"offset" is the offset into the mapping, "dev" is the device (major:minor), and
"inode" is the inode  on that device.  0 indicates that  no inode is associated
with the memory region, as the case would be with BSS (uninitialized data).
The "pathname" shows the name associated file for this mapping.  If the mapping
is not associated with a file:

 [heap]                   = the heap of the program
 [stack]                  = the stack of the main process
 [vdso]                   = the "virtual dynamic shared object",
                            the kernel system call handler

 or if empty, the mapping is anonymous.


Parameter Code Related Internals

struct proc_dir_entry *my_proc_file = NULL;
 /* Create a proc file */
my_proc_file = create_proc_entry("rt-embedded", S_IRUSR |S_IWUSR | S_IRGRP | S_IROTH, NULL);

if (my_proc_file)
{
  /* Setup the Read and Write functions */
  my_proc_file->read_proc  = my_proc_read;
  my_proc_file->write_proc = my_proc_write;
}

Related From a Paper

The full address space of a process is rarely used, only sparse regions are. Each
region is represented by a vm_area_struct which never overlap and represent a set
of addresses with the same protection and purpose. Examples of a region include
a read-only shared library loaded into the address space or the process heap. A
full list of mapped regions a process has may be viewed via the proc interface at
/proc/PID/maps where PID is the process ID of the process that is to be examined.
The region may have a number of di?erent structures associated with it as illus-
trated in Figure 5.2. At the top, there is the vm_area_struct which on its own is
enough to represent anonymous memory.
If a ?le is memory mapped, the struct ?le is available through the vm_file ?eld
which has a pointer to the struct inode. The inode is used to get the struct
address_space which has all the private information about the ?le including a set
of pointers to ?lesystem functions which perform the ?lesystem speci?c operations
such as reading and writing pages to disk

source :
Understanding The
Linux Virtual Memory Manager
Mel Gorman
15th February 2004


			

Click to access understand.pdf

Theory Drop

In  computer  science, a  heap  is  a  specialized tree-based  data
structure that satisfies the heap property
Heaps

A binary tree has the heap property iff
it is empty or
the key in the root is larger than that in either child and both subtrees have the heap property.

source:http://en.wikipedia.org/wiki/Heap_(data_structure)
http://www.cs.auckland.ac.nz/~jmor159/PLDS210/heaps.html

Fix Required

Related from Paper section has junk charecters
which should be replaced by proper letters.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s