Linux Memory – Mathematical Connection Between SZ RSS and VSZ in ps Output

linuxmemoryps

I wanted to know what mathematical connection is there between the SZ, RSS and VSZ output in ps output e.g.

ps -p 2363 -o sz,rss,vsz

Best Answer

sz and vsz represent the same thing, but sz is in page units, while vsz is in 1024 byte units.

To get your system's page size, you can use:

$ getconf PAGE_SIZE
4096

rss is the subset of the process's memory that is currently loaded in RAM (in kilobytes). This is necessarily smaller than vsz.

So the "mathematical" connections are:

vsz * 1024 = sz * page_size
rss <= vsz
Related Question