What Does Self-Relocating Program Mean?

A self-relocating program is one that relocates its address-sensitive instructions to other parts of the memory. The program performs its own relocation and does not require a linker. Self-relocation is used in time-sharing operating systems where the load address of a program may change for each different execution.

Techopedia Explains Self-Relocating Program

A self-relocating program alters itself to execute from a different location of the memory. Self-relocation eliminates the need to have several copies of a program on a disk, with each copy having its own different load origin. However, self-relocating programs are not necessary when the computer uses virtual memory.

  • A table of the address-sensitive instructions. The program must know the translated origin and the execution start address as well as the addresses of the address-sensitive instructions.A relocating logic, which is the code that performs the relocation process.

The two functions are inbuilt into the program; the start address of the relocating code is usually specified as the execution start address of the program. Once the program is loaded into the memory for execution, the relocating logic takes control and performs the relocation using the load address and the information regarding the address-sensitive instructions.