Linkers, Loaders & Executables
Which lists the typical memory layout of a process on Linux and similar systems from low to high addresses?
- AText → data → BSS → heap → (free space) → stack
- BStack → text → heap → data → BSS
- CHeap → stack → BSS → data → text
Show answer and explanation
Answer: A. Text → data → BSS → heap → (free space) → stack
In a typical layout, from low addresses up come the text (machine code), the initialized data and the zero-initialized BSS, with the heap above them growing toward higher addresses. The stack grows downward from the high end, and shared libraries and mmap regions are placed in the large gap between them. For security, ASLR shifts the actual addresses on every run.
- A. Correct. The heap grows up and the stack grows down.
- B. The stack sits at the high-address end.
- C. Text sits at the low-address end.