Page Space Problems
Jeff Peek
ransom at perelandra.austin.ibm.com
Tue Mar 19 01:35:23 AEST 1991
In article <1991Mar17.185553.9181 at menudo.uh.edu> jet at karazm.math.uh.edu ("J. Eric Townsend") writes:
>Again, I repeat my plea for some IBM employee to come out of the woodwork
>and explain this:
>
>oiler> ps aux
> USER PID %CPU %MEM SZ RSS TT STAT TIME CMD
> root 0 0.0% 78% 7592 6376 - S 1:31 swapper
> root 1 0.1% 1% 164 120 - S 2:41 /etc/init
> root 514 0.0% 0% 12 8 - R 3994:08 kproc
> root 771 0.0% 0% 20 20 - S 0:05 kproc
> root 1028 0.1% 0% 16 16 - S 3:45 kproc
> root 1285 0.0% 0% 16 8 - S 0:00 kproc
> root 1685 0.0% 0% 84 28 - S 0:18 /etc/syncd 60
> jet 1867 2.9% 5% 168 404 pts/0 S 0:01 -csh
>....
[my previous posting about what SZ meant for process 0 was incorrect.]
OK. You wanted it you got it. I did some mucking around in the code and
actual experimentation on the machine and here is what I found.
When you run ps -lk (the way I used to get the sizes for all the kprocs)
you get:
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
b03 S 0 0 0 120 16 -- 1008 11008 - 4:50 swapper
303 R 0 514 0 103 127 -- 1209 28 - 9332:43 kproc
303 S 0 771 0 0 37 -- a05 36 20cd0 - 4:00 kproc
303 S 0 1028 0 1 39 -- 160b 36 20cd8 - 10:20 kproc
303 S 0 1285 0 0 36 -- 180c 32 20ce0 - 0:00 kproc
40201 S 0 1645 1 0 60 20 3058 32 - 0:00 kproc
40a01 S 0 2641 1 0 60 20 e27 32 - 0:00 kproc
40b03 S 0 4016 1 0 39 -- 8a4 32 1bbd844 - 3:08 kproc
a01 S 7 7856 4527 0 60 20 fc7 32 - 0:00 kproc
Here is a description of what is in the SZ field:
SZ (-l, l) The size in 1024 byte units of the core image of the
process.
So, SZ is in 1K chunks. Then it appears my swapper is close to 11meg.
The nitty gritty:
The SZ is based on the number of paging space blocks (4K) associated with
the TEXT and DATA segments for a process. Note, this is NOT real memory, just
the number of page spaces blocks used by the process. The DATA segment includes
user data, user stack, kernel stack, and the ublock.
Now, the segments register values used for the calculation are taken from the
u_adspace structure from the process's ublock. These srvals amount to the user's
address space in USER MODE!
The swapper is a special kproc, handcrafted at System Initialization. The u_adspace
structure for the swapper is never initialized, i.e., it is all zeroes. On the
RISC System/6000 an invalid segment register value is 7fffff. '0' is a valid
srval and in fact is the srval for the kernel's text segment. This segment is
only addressable to processes in kernel mode. So, ps is counting the kernel's TEXT
segment TWICE for process 0. The reason this is not a problem for other kernel processes
is that their u_adspace structure is inherited from their parent when they are
created, thus initialized properly.
Only process 0 has no parent (or is it it's own mother and father?).
The strange but true facts about the swapper.
>--
>J. Eric Townsend - jet at uh.edu - bitnet: jet at UHOU - vox: (713) 749-2120
>Skate UNIX or bleed, boyo...
>(UNIX is a trademark of Bell Laboratories).
Jeff Peek
AIX Operating System Architecture -- IBM Personal Systems Programiming
ransom at perelandra.austin.ibm.com VNET PEEK at AUSVMQ T/L 793-3935
Austin, TX
More information about the Comp.unix.aix
mailing list