Linkers, Loaders & Executables

Which lists the typical memory layout of a process on Linux and similar systems from low to high addresses?

  1. AText → data → BSS → heap → (free space) → stack
  2. BStack → text → heap → data → BSS
  3. 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.
Practice this topic Back to topic

More Linkers, Loaders & Executables questions

  1. What is the advantage of laying out the heap and stack so they grow in opposite directions with a large gap between them?
  2. Which describes static linking?
  3. What is an advantage of dynamic linking (shared libraries)?
  4. A dynamically linked program copied to another computer fails to start. What is the most likely cause?
  5. When linking with a static library (.a file), what does the linker put into the executable?