Calculate a process's Resident Set Size and its share of total physical memory.
RSS (Resident Set Size) is the portion of a process's memory that is held in physical RAM — as opposed to swapped out or not yet faulted in. It includes both private pages (unique to the process) and shared pages (shared libraries, mmap'd files shared with other processes). RSS divided by total physical memory gives the process's footprint as a percentage, useful for capacity planning and identifying memory-hungry processes.
RSS percentage
rss_percent = (RSS_KB / total_physical_KB) × 100
RSS counts only pages actually resident in physical RAM, while VSZ (Virtual Size) counts the entire virtual address space including memory-mapped files, reserved regions, and swapped-out pages — VSZ is always >= RSS.
Not accurately — shared pages (libraries like libc) are counted in every process's RSS that maps them, so summing overcounts. Use PSS (Proportional Set Size from /proc/PID/smaps) for accurate per-process accounting.