Learning Solaris Internals : Memory Paging

I am learning from the first edition of Solaris Internals, where the following is stated, talking about a user process:

“Initially, a single page is allocated for the stack, and as the process executes and calls functions, it pushes the program counter, arguments, and local variables onto the stack. When the stack grows larger than one page, the process causes a page fault, and the kernel notices that this is a stack segment page fault and grows the stack segment.”

I wanted to verify this first statement:

 

[pts/1][~] uname -a; cat /etc/release
SunOS blade72 5.8 Generic_117350-51 sun4u sparc SUNW,Sun-Blade-100
                       Solaris 8 2/02 s28s_u7wos_08a SPARC
           Copyright 2002 Sun Microsystems, Inc.  All Rights Reserved.
                           Assembled 18 December 2001

[pts/1][~] alias | grep cpuarch
cpuarch kstat | /usr/bin/grep implementation
[pts/1][~] cpuarch
        implementation                  UltraSPARC-IIe
[pts/1][~] getconf PAGE_SIZE
8192
[pts/1][~] /bin/pagesize
8192
[pts/1][~] cat&
[1]  + Suspended (tty input)         cat
[pts/1][~] alias | grep mypid
getmypid        ps | grep !:1 | cut -f2 -d' '
[pts/1][~] pmap `getmypid cat`
26953:  cat
00010000      8K read/exec         /usr/bin/cat
00022000      8K read/write/exec   /usr/bin/cat
00024000     16K read/write/exec     [ heap ]
FF280000    688K read/exec         /usr/lib/libc.so.1
FF33C000     32K read/write/exec   /usr/lib/libc.so.1
FF370000      8K read/write/exec     [ anon ]
FF380000     16K read/exec         /usr/platform/sun4u/lib/libc_psr.so.1
FF390000      8K read/write/exec   /usr/lib/libdl.so.1
FF3B0000    192K read/exec         /usr/lib/ld.so.1
FF3E0000      8K read/write/exec   /usr/lib/ld.so.1
FF3E2000      8K read/write/exec   /usr/lib/ld.so.1
FFBEE000      8K read/write/exec     [ stack ]
total     1000K
[pts/1][~] pmap -x `getmypid cat`
26953:  cat
Address   Kbytes Resident Shared Private Permissions       Mapped File
00010000       8       8       8       - read/exec         cat
00022000       8       8       -       8 read/write/exec   cat
00024000      16      16       -      16 read/write/exec     [ heap ]
FF280000     688     688     688       - read/exec         libc.so.1
FF33C000      32      32       -      32 read/write/exec   libc.so.1
FF370000       8       8       -       8 read/write/exec     [ anon ]
FF380000      16      16      16       - read/exec         libc_psr.so.1
FF390000       8       8       -       8 read/write/exec   libdl.so.1
FF3B0000     192     192     192       - read/exec         ld.so.1
FF3E0000       8       8       -       8 read/write/exec   ld.so.1
FF3E2000       8       8       -       8 read/write/exec   ld.so.1
FFBEE000       8       8       -       8 read/write/exec     [ stack ]
--------  ------  ------  ------  ------
total Kb    1000    1000     904      96

Anyways, in summary we see that the pagesize is 8KB and the Stack is mapped one page as shown from pmap output.

Leave a Reply

Your email address will not be published. Required fields are marked *

*