Program relocation concepts: which statement best defines a self-relocating program with respect to address-sensitive code and execution location?
-
Acannot be made to execute in any area of storage other than the one designated for it at the time of its coding or translation
-
Bconsists of a program and relevant information for its relocation
-
Ccan itself perform the relocation of its address-sensitive portions
-
DAll of the above
-
ENone of the above
Answer
Correct Answer: can itself perform the relocation of its address-sensitive portions
Explanation
Introduction / Context:Relocation is the process of adjusting address-sensitive code and data so that a program can execute correctly no matter where it is loaded in memory. Loaders, linkers, and sometimes programs themselves participate in relocation. This question distinguishes a self-relocating program from other relocation scenarios.
Given Data / Assumptions:
- We are considering executable images that may be placed at varying memory addresses at load time.
- Address-sensitive portions include absolute addresses and pointer-like references embedded in the code/data.
- Relocation can be performed by external tools or by the program itself.
Concept / Approach:A self-relocating program contains logic to adjust its own address-sensitive references when it starts (or as it loads). It computes the load-time delta and patches internal tables or code/data locations accordingly. This contrasts with non-relocatable programs (must reside at a fixed address) and relocatable programs that rely on an external relocating loader with relocation information.
Step-by-Step Solution:1) Identify the essence of “self-relocating”: relocation performed by the program itself.2) Exclude fixed-location programs, which cannot relocate at all.3) Exclude programs that merely carry relocation info but depend on an external loader.4) Conclude: the correct description is that the program can itself relocate its address-sensitive parts.
Verification / Alternative check:Bootstrapping code (e.g., certain loaders or resident monitors) historically demonstrated self-relocation: upon start, they compute the current load base, add offsets to pointers, and continue execution correctly regardless of placement.
Why Other Options Are Wrong:
- Cannot execute elsewhere: This defines non-relocatable code, the opposite of self-relocating.
- Program plus relocation info: That describes relocatable objects processed by a relocating loader, not self-relocation.
- All of the above: Mutually inconsistent statements; only one is correct.
- None of the above: Incorrect because self-relocation (option C) is correct.
Common Pitfalls:Confusing “relocatable” (has info for an external loader) with “self-relocating” (performs its own relocation). The presence of relocation entries does not imply the program will patch itself at runtime.
Final Answer:can itself perform the relocation of its address-sensitive portions.