LINUXOR.SK ... open source notes ...

Linux Process Memory - from the address space to what the tools report

category: learnz/memory · date: 2017-01-01 · updated: 2026-10-04 · author: LALA · theme: github

This Learning is about the memory of a user process in Linux. The first article explains how the kernel lays out and describes a process's virtual memory and how that memory can be read from outside; the second shows what the usual tools report and why their numbers differ.

noteThe articles were written in 2017 and are kept as they were written. The kernel structures shown are from the kernels of that time; /proc/<PID>/maps, /proc/<PID>/mem and the meaning of VSS, RSS, PSS and USS have not changed.

Both articles end with a section Current practice, which says what has changed since and what to do instead today.

The levels

Each level ends with a small check. There is no time limit: when you can do what the check asks, go on to the next level.

LevelYou practiceYou have passed the level when
1 · UnderstandPhysical and virtual memory, paging, the address space and its regionsYou can draw the memory regions of a process and say what each one holds
2 · ReadThe memory descriptor, /proc/<PID>/maps, reading a region from /proc/<PID>/memYou can find the heap and the stack of a running process in its maps file
3 · Measureps, pmap, smem and ps_mem.py on the same processYou can say what VSS, RSS, PSS and USS each count, and which one answers "how much would I get back if this process ended"

Levels 1 and 2 are the first article: sections 1 and 2 for level 1, sections 3 to 6 for level 2. Level 3 is the second article.

The articles

Both articles also exist in Slovak, the language they were written in; the (SK) link is at the top of each.

#ArticleWhat it is
1The virtual memory of a user process in LinuxLevels 1 and 2: the address space, the memory regions, the kernel's memory descriptor, and tools that read and dump process memory
2Diagnosing process memory use in LinuxLevel 3: the four memory figures, the tools that report them, and a worked measurement of Midnight Commander

What you will be able to do

Set up once

A Linux machine where you are root. The second article downloads smem and ps_mem.py; both are single scripts.

Final check

Pick a process on your machine and report its memory with two tools. Explain why the two numbers differ.