jarmolow@samsung.samsung.com (Tom Jarmolowski) (06/05/90)
How does one determine the system memory usage, both physical and virtual? "ps" and "top" both often report a programs size (SZ) as less than the resident size (RSS). This does not seem reasonable. Further, how does the space required for shared libraries get accounted ? Is it charged againt each program using the library ? Not accounted at all ? Tom Jarmolowski _/_ Samsung Software America / __ _____ jarmolow@samsung.com (__ (_) / / <_ ...uunet!samsung!jarmolow (508) 685-7200 x133
mnichols@atlantis.psi.siemens.com (06/06/90)
> How does one determine the system memory usage, both physical and virtual? > > "ps" and "top" both often report a programs size (SZ) as less than the > resident size (RSS). This does not seem reasonable. Further, how does > the space required for shared libraries get accounted ? Is it charged > againt each program using the library ? Not accounted at all ? I wondered the same thing and by sleuthing the man page for ps this is what appears to be the answer question numero 2. ------------ excerpt from the ps(1) man page --------------- SIZE SZ The combined size of the data and stack segments (in kilobyte units) RSS Real memory (resident set) size of the process (in kilobyte units). Note that SZ does not include the text segment this accounts for the difference in the two values I would guess. Mark Nichols ! internet: mnichols@psivax.psi.siemens.com Pacesetter Systems Inc. ! voice: (818) 362-6822 x3104 Sylmar, California 91342 !
lm@sun.com (Larry McVoy) (06/07/90)
> How does one determine the system memory usage, both physical and virtual? > > "ps" and "top" both often report a programs size (SZ) as less than the > resident size (RSS). This does not seem reasonable. Further, how does > the space required for shared libraries get accounted ? Is it charged > againt each program using the library ? Not accounted at all ? SZ represents the size of the executable associated with this process. The executable is the chunk of code that contains main(). It may not contain much more than that. A process has a virtual address space, broken into page sized chunks. In order to use a page of its address space the process must have a translation (something that converts from virtual addr to physical addr). The RSS size represents the number of active translations. It has little to do with SZ. Since shared libraries are mmap-ed into a process' address space, the RSS gets larger while the SZ stays the same. This is where we get the confusing SZ < RSS numbers. Because of the sharing of libraries, computing the amount of memory in use by a single process has become difficult. There are pointers to what it is using but no back pointers to who else is using the same thing. So it's easy to say that "ls" is using 5 pages of libc. It's hard to figure out who else might be using those same pages. Larry McVoy, Sun Microsystems (415) 336-7627 ...!sun!lm or lm@sun.com