In program loading and memory management, what defines a non-relocatable program in terms of where it can execute in memory?

Difficulty: Easy

Correct Answer: Cannot execute anywhere other than the specific memory area fixed at coding or translation time

Explanation:


Introduction / Context:
Loaders, linkers, and operating systems determine where a program resides in memory. Some binaries can be relocated at load time; others are tied to absolute addresses. Understanding the distinction impacts OS design and portability.


Given Data / Assumptions:

  • We contrast relocatable vs non-relocatable binaries.
  • Address-sensitive code may use absolute addresses.
  • No position-independent code mechanism is assumed.


Concept / Approach:
A non-relocatable program has absolute address references baked in at assembly/link time, requiring it to load into the exact memory region anticipated by those addresses. Any deviation breaks jumps or data references. Relocatable programs include relocation entries; position-independent code avoids absolute addresses using relative addressing and indirection.


Step-by-Step Solution:

1) Identify absolute references emitted by the linker.2) Recognize loader constraints: must map the program to the predetermined base.3) If loaded elsewhere, address calculations fail, causing crashes.4) Therefore classify as non-relocatable: fixed-location only.


Verification / Alternative check:
Examining the object file shows no relocation records enabling the loader to patch addresses; attempts to relocate result in invalid instruction targets or data access.


Why Other Options Are Wrong:

  • Program plus relocation info: That describes a relocatable program.
  • Self-relocation: Describes a program capable of adjusting itself, not non-relocatable.
  • All of the above: Mutually inconsistent statements; only the fixed-location definition applies.
  • None of the above: Incorrect because the fixed-location definition is correct.


Common Pitfalls:
Confusing “non-relocatable” with “position-independent”; they are opposites in terms of flexibility at load time.


Final Answer:
Cannot execute anywhere other than the specific memory area fixed at coding or translation time

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion