Understanding memory allocation costs in the .bss segment
This is a medium-difficulty operating systems question that tests your understanding of how the compiler and loader handle uninitialized global data. It asks you to reason about the distinction between static allocation in memory and the actual runtime cost of bringing that memory into the process address space.
The question hinges on knowing how different executable sections — particularly the .bss (block started by symbol) segment — are handled during compilation, linking, and program initialization on x86. A strong answer requires you to distinguish between the number of times a variable's storage is logically allocated versus the actual cost incurred at different stages of program loading and execution.
- Executable file format and section layout (.text, .data, .bss)
- Loader behavior and memory mapping
- Difference between file size and in-memory size
- Zero-initialization and lazy allocation strategies