
The TSIZ value does not reflect actual memory usage. This number represents only an upper bound on the amount of text that could be loaded. Pages of the text section of the executable program are only brought into memory when they are touched, that is, branched to or loaded from. This is the size of the text section of the executable file. If 26 ksh processes are running, only one copy of any given page of the ksh executable program would be in memory, but the ps command would report that code segment size as part of the RSS of each instance of the ksh program. Remember that code segment pages are shared among all of the currently running instances of the program. This number is equal to the sum of the number of working segment and code segment pages in memory times 4. Real-memory (resident set) size in kilobytes of the process. SIZE includes pages in the private segment and the shared-library data segment of the process.

If some working segment pages are currently paged out, this number is larger than the amount of real memory being used. This number is equal to the number of working segment pages of the process that have been touched times 4. Virtual size (in paging space) in kilobytes of the data section of the process (displayed as SZ by other flags). Since all I/O is classified as page faults, this is basically a measure of I/O volume. Number of page-ins caused by page faults. If you want to limit to just the process which you are running from the current terminal: ps vĮxample output: PID TTY STAT TIME PGIN SIZE RSS LIM TSIZ TRS %CPU %MEM COMMANDģ6626 pts/3 A 0:00 0 38 51 60 0.0 0.0 ps v To sort all running processes by their memory & CPU usage.

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND Note: the exact format of this can vary from distro to distro. The Vm* fields contain the information you seek. Which will output something like: # cat /proc/7049/status

If you want the usage from within the process: cat /proc/self/status # or read the file with fopen() or whatnot If you know the process ID: cat /proc/$pid/status
