Loader functions: identify what the loader does during program preparation and startup.
Computer Science
Language Processors
Difficulty: Easy
Choose an option
-
AAllocate memory space and resolve symbolic references between object modules
-
BPhysically place machine instructions and data into memory
-
CAdjust all address-dependent locations to correspond to allocated space (relocation)
-
DAll of the above
-
ENone of the above
Answer
Correct Answer: All of the above
Explanation
Introduction / Context:The loader bridges the gap between compiled/assembled object code and execution. It sets up memory, resolves addresses, and relocates code/data as needed. This question checks awareness of the loader’s concrete responsibilities.
Given Data / Assumptions:
- Input: one or more object modules (and libraries).
- Output: a loaded, relocatable or fixed image ready to run.
- Symbol resolution and relocation are required for correct addressing.
Concept / Approach:
- Loading includes placement, relocation, and link-time resolution (static or dynamic).
- All listed tasks are classic loader/linker duties.
Step-by-Step Solution:
Allocate memory regions for code, data, stack/heap.Resolve external symbols among modules/libraries.Relocate address-dependent instructions/data to actual memory locations.Transfer control to program entry point.Verification / Alternative check:
Modern OS loaders (e.g., ELF/PE loaders) perform these steps routinely; dynamic linkers additionally bind shared libraries at load/run time.Why Other Options Are Wrong:
- Each of A, B, C is a correct sub-function; therefore “All of the above” is the best answer.
- None of the above: Incorrect because these are standard loader responsibilities.
Common Pitfalls:
- Confusing compile-time linking with load-time dynamic linking—both involve symbol resolution but at different stages.
Final Answer:
All of the above