Machine-translated by Google. Questions are authored in English.
Top

Discussion

A relocatable program is one that

  • A.can be loaded and run at any address in memory
  • B.must always start at address zero
  • C.cannot be swapped out once loaded
  • D.runs only on one type of processor

Answer: D

Correct answer: can be loaded and run at any address in memory

A relocatable program can be placed anywhere in memory, because its addresses are expressed relative to a starting point rather than as absolute values. The loader or the hardware supplies the actual base. The alternative is absolute code, produced by binding addresses at compile time. It must be loaded at one fixed address, and moving it requires recompilation - workable only where a single program owns the machine. Relocation may happen at load time, when the loader adjusts every address once, after which the program cannot move; or at execution time, when a base register is added to each address by hardware, and the program can be moved simply by changing the register. Only execution-time binding permits swapping and compaction, since both require a running process to change location. It is what every general-purpose system uses, and paging is its general form, with a page table in place of a single register.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.