In the last episode (Oct 14), Artem Kuchin said: > Maybe someone with deeper knowledge of the internals of FreeBSD can > clean up something for me (any for many others)^ > > Here are lines from my top: > > PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND > 9258 hordelo_ru 1 4 0 40992K 4260K accept 0 0:00 0.00% httpd > 9257 hordelo_ru 1 44 0 40992K 4296K select 1 0:00 0.00% httpd > 9259 hordelo_ru 1 4 0 40992K 4292K select 1 0:00 0.00% httpd > > As you see, 'size' is the same for all processes, while RES varies. > > As i understand, the real memory taken by a process is RES and SIZE > include a bunch of shares .so libs, so, if more httpd's started each > will take only about 4300K more, so, 100 https will take 430000K to > run, right?
Determining the amount of shared vs unshared memory for each process is not totally trivial. All I can suggest is using procfs and reading /proc/<<PID>>/map eg: turion% dd if=/proc/curproc/map bs=256k 0x400000 0x402000 2 0 0xffffff002e4710e0 r-x 1 0 0x0 COW NC vnode /bin/dd 0x502000 0x503000 1 0 0xffffff001c41cd20 rw- 2 0 0x2180 NCOW NNC default - 0x503000 0x505000 2 0 0xffffff001c41cd20 rwx 2 0 0x2180 NCOW NNC default - and so on The columns are: start address, end address, resident pages, private resident pages, vm_object_t address, protection, reference count, shadow count, flags, cow, copy-needed, type, path See <vm/vm_object.h> for flags This will let you indentify shared vs private space as well as whether it's file or swap backed. -- Peter Jeremy
pgpTgKJQKBT1Q.pgp
Description: PGP signature