Igor Kovalenko <kovalenko@attbi.com> wrote:
“Robert Krten” <> rk@parse.com> > wrote in message
news:biigat$ceh$> 2@inn.qnx.com> …
[…]
That means 132Kx4 + 16K + 312K + 16K = 872K. I don’t know why ls -l
/proc/4105/as is different, I’m not even sure that the filesize of “as”
should
represent the size of the address space (admittedly it seems intuitive
that it
would).
Well, one of them must be wrong. Like the Dire Straits song goes, “there
are
two Jesus’s on the corner, one of them must be wrong” > 
Unless one of them is just great and another is truly, truly wonderful. Then
they can both be right, like catholics & protestants.

Personally, I feel a little better about a pipe process that is only
250K or so
bigger than the entire QNX2 operating system running 20 or so processes,
than I
do about it being almost twice the size > 
Measuring size of the process that way is not very helpful. Take a look at
what spin reports for size of the ‘pipe’. You need to read and interpret all
the memory mappings for a given process using certain devctls() on
/proc/pid/as. There’s some black magic involved.
As of why ls -l shows rather different size of ‘as’, I am not sure. But
intuitively, that could mean that address space reserved for a process can
be a lot bigger than the actual amount of memory consumed. This can be due
to many reasons, some of which could be quite logical and others could be
purely implementation-imposed.
Since I’m going through this in great and horrible detail for the book, here
are the current readings…
pidin -p4105 mem
pid tid name prio STATE code data stack
4105 1 sbin/pipe 10o RECEIVE 16K 148K 4096(132K)
4105 2 sbin/pipe 10o RECEIVE 16K 148K 4096(132K)
4105 4 sbin/pipe 10o RECEIVE 16K 148K 4096(132K)
4105 5 sbin/pipe 10o RECEIVE 16K 148K 4096(132K)
ldqnx.so.2 @b0300000 312K 16K
procfs (output editted)
Info from DCMD_PROC_PAGEDATA
Buff# --vaddr— —size— —flags-- —dev---- —ino----
[ 0] 0x07F22000 0x00001000 0x01001083 0x00000002 0x00000001
[ 1] 0x07F23000 0x0001F000 0x01001783 0x00000002 0x00000001
[ 2] 0x07F42000 0x00001000 0x01401783 0x00000002 0x00000001
[ 3] 0x07F43000 0x00001000 0x01001083 0x00000002 0x00000001
[ 4] 0x07F44000 0x0001F000 0x01001783 0x00000002 0x00000001
[ 5] 0x07F63000 0x00001000 0x01401783 0x00000002 0x00000001
[ 6] 0x07F64000 0x00001000 0x01001083 0x00000002 0x00000001
[ 7] 0x07F65000 0x0001F000 0x01001783 0x00000002 0x00000001
[ 8] 0x07F84000 0x00001000 0x01401783 0x00000002 0x00000001
[ 9] 0x07FA6000 0x00001000 0x01001083 0x00000002 0x00000001
[ 10] 0x07FA7000 0x0001F000 0x01001783 0x00000002 0x00000001
[ 11] 0x07FC6000 0x00001000 0x01401783 0x00000002 0x00000001
[ 12] 0x07FC7000 0x00001000 0x01001083 0x00000002 0x00000001
[ 13] 0x07FC8000 0x0007E000 0x01001383 0x00000002 0x00000001
[ 14] 0x08046000 0x00002000 0x01401383 0x00000002 0x00000001
[ 15] 0x08048000 0x00004000 0x00400571 0x00000001 0x00000009
[ 16] 0x0804C000 0x00001000 0x01400372 0x00000001 0x00000009
[ 17] 0x0804D000 0x00024000 0x01400303 0x00000002 0x00000001
[ 18] 0xB0300000 0x0004E000 0x00410561 0x00000004 0xB0300000
[ 19] 0xB034E000 0x00004000 0x01400772 0x00000004 0xB0300000
Ok, buffers 0, 3, 6, and 9 are the 4k stack in use by each thread.
Buffers 1, 4, 7, and 10 are the allocated (but not used) stack for each thread.
Buffers 2, 5, 8, and 11 are the 4k guard page for each stack.
Buffers 12, 13, and 14 are MAP_STACK… Prolly for the dead thread (thread 3).
(Bit 0x0400 might be PROT_EXEC, turned on for the first 4 stacks and off for the fifth…???)
Buffers 18 and 19 are the shared library (code and data).
What can we make of buffers 15, 16, and 17?
Buffer 15 is EXEC/READable, prolly the code (0x4000 matches pidin mem output)
Buffer 16 is 4k, r/w, mapped private… ?
Buffer 17 is r/w mapped shared AND private ???
Summing up all the memory shown by DCMD_PROC_PAGEDATA yields:
0x1000 x 10 + 0x1f000 x 4 + 0x7e000 + 0x2000 + 0x4000 + 0x24000 + 0x4e000 + 0x4000 = 0x180000 (1.5MB)
So, it’s bigger than the “as” file.
Any insights?
Cheers,
-RK
–
[If replying via email, you’ll need to click on the URL that’s emailed to you
afterwards to forward the email to me – spam filters and all that]
Robert Krten, PDP minicomputer collector http://www.parse.com/~pdp8/