operating-systemcompile-timeexecution-timeload-time

Confusions about address binding


Compile time. If you know at compile time where the process will reside in memory, then absolute code can be generated. For example, if you know that a user process will reside starting at location R, then the generated compiler code will start at that location and extend up from there. If, at some later time, the starting location changes, then it will be necessary to recompile this code. The MS-DOS .COM-format programs are bound at compile time.

Load time. If it is not known at compile time where the process will reside in memory, then the compiler must generate relocatable code. In this case, final binding is delayed until load time. If the starting address changes, we need only reload the user code to incorporate this changed value.

Execution time. If the process can be moved during its execution from one memory segment to another, then binding must be delayed until run time. .


Solution

  • To begin with, I would find a better source for your information. What you have is very poor.

    What can be the reason of the starting location to change? Can it be because of context switching/swapping ?

    You change the code or need the code to be loaded at a different location in memory.

    Does absolute code means binary code?

    No. They are independent concepts.

    How is relocatable code different from absolute code? Does it contain info about base,limit and relocation register?

    Relocatable code uses relative addresses, generally relative to the program counter.

    (Base limit and relocation registers would be a system specific ocncept).

    How is reloading more efficient then recompiling as they mentioned only reload means no recompiling only reload?

    Let's say two different programs use the same dynamic library. They made need to have loaded at different locations in memory. It's not an efficiency issue.

    Why it may be needed to move a process during it's execution?

    This is what was done in ye olde days before virtual memory. To my knowledge no one does this any more.

    How compile and load-time methods generate identical logical and physical addresses?

    I don't know what the &^54 they are talking about. That statement makes no sense.