Infodoc ID |
|
Synopsis |
|
Date |
16986 |
|
process address space & pmap |
|
11 Dec 1998 |
See the following URL:
http://www.sun.com/sunworldonline/swol-12-1997/swol-12-insidesolaris.html
Excerpts from the above article, "Swap space implementation, Part One":
An address space is comprised of pages, representing all the memory required to
maintain the segments a process is comprised of. These are the processes' text
(executable code), data (code variables), and stack (a place to store state
information for function call returns). Processes may also have "heap" space,
chunks of memory allocated as a result of applications calling memory
allocation
routines like sbrk(2) and malloc(3), as well as shared memory interfaces
shmget(2) and shmat(2). The pages that make up a process's heap space are
referred
to as anonymous memory in Solaris because the pages have no corresponding name
or
space in the file system.
Here's an example of a process's address space. We wrote a small C program that
has a few instructions in it and some signal handlers in place (more on the
signal
handlers later):
fawlty> /usr/proc/bin/pmap 2141
2141: p1
00010000 8K read/exec dev:172,4 ino:1268005
00020000 8K read/write/exec dev:172,4 ino:1268005
EF6E0000 16K read/exec /usr/platform/sun4u/lib/libc_psr.so.1
EF700000 592K read/exec /usr/lib/libc.so.1
EF7A2000 24K read/write/exec /usr/lib/libc.so.1
EF7A8000 8K read/write/exec [ anon ]
EF7B0000 8K read/exec/shared /usr/lib/libdl.so.1
EF7C0000 112K read/exec /usr/lib/ld.so.1
EF7EA000 16K read/write/exec /usr/lib/ld.so.1
EFFFC000 16K read/write/exec [ stack ]
total 808K
fawlty>
Using the pmap(1) command, which dumps a process's address space map, we can
see what mapping exists for running processes. The column on the far left is
the virtual address of the mapping, followed by the size in bytes, the
permissions, and finally the object name. In our example, a relatively small
program, we see mappings for the process text (virtual addresses 10000 and
20000);
the required shared object libraries (addresses EF6E0000, EF700000,
EF7A2000, EF7B0000, EF7C0000, EF7EA000); the stack mapping (EFFFC000); and an
anonymous memory mapping (EF7A8000). The total virtual address space for the
process is 808 kilobytes. (We're going to revisit our process address
space example a little later in the column.)
see also:
INFODOC ID: 11923
SYNOPSIS: How can one tell how much memory is being used by a process
Top
Sun Proprietary/Confidential: Internal Use Only
Feedback to SunSolve Team