Process size on UNIX

size, unix

Solution

The exact definitions of `vsize`, `rss`, `rprvt`, `rshrd`, and other obscure-looking abbreviations vary from OS to OS. The manual pages for the `top` and `ps` commands will have some sort of description, but all such descriptions are simplified greatly (or are based on long-extinct kernel implementations). "Process size" as a concept is fiendishly difficult to pin down in the general case. Answers in specific instances depend heavily on the actual memory management implementation in the OS, and are rarely as satisfying as the tidy "process size" concept that exists in the minds of most users (and most developers).

For example, none of those numbers (nor, likely, any combination of them) can be used to tell you exactly how many such processes can run at once in a given amount of free memory. But really, your best bet is to come at it from that end: why do you want this number, and what will you use it for? Given that information, I think you'll get more useful answers.

Problem

What is the correct way to get the process size on `Solaris, HP-UX` and `AIX`? Should we use `top` or `ps -o vsz` or something else?

Original source