Difficulty: Easy
Correct Answer: All of the above
Explanation:
Introduction / Context:
In operating systems and system programming, a loader is responsible for preparing a compiled program for execution. It takes the output of the linker (often relocatable or executable object files) and ensures the program occupies appropriate memory with all addresses adjusted correctly so that the CPU can begin execution without faults.
Given Data / Assumptions:
Concept / Approach:
A classical loader will: (1) allocate memory for the program's segments, (2) resolve external symbols not fixed at link time (or finalize relocations), and (3) copy or map program text/data into RAM, then transfer control to the entry point. These tasks correspond to space allocation, relocation/adjustment of address-dependent locations, and physical placement (loading) of code and data.
Step-by-Step Solution:
Verification / Alternative check:
Standard OS texts define loader duties exactly as memory allocation, relocation, binding, and loading, often followed by setting up the initial process state and jumping to the program's entry point.
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
All of the above.
Discussion & Comments