Process Memory
Last updated
Last updated
A computer program memory can be largely categorized into two sections: read-only and read/write. As systems became more complex and programs were loaded from other media into RAM instead of executing from ROM, the idea that some portions of the program's memory should not be modified was retained. These became the .text and .rodata segments of the program, and the remainder which could be written to divided into a number of other segments for specific tasks.
Read the "The Linux Programming Interface/Processes" section:
ProcessesData on most modern systems is stored backwards, in little endian. For example, 0x0A0B0C0D
is stored as 0D 0C 0B 0A
in memory if the machine is little-endian:
Why?
Performance (historical)
Ease of addressing for different sizes.
(apocryphal) 8086 compatibility
pwndbg has a vmmap
command that allows you to investigate program memory segments. For example, write a simple Hello World program in C:
Compile it:
Run this program in GDB and check vmmap
: