0
votes

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.

  • What can be the reason of the starting location to change? Can it be because of context switching/swapping ?
  • Does absolute code means binary code?

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.

  • How is relocatable code different from absolute code? Does it contain info about base,limit and relocation register?
  • How is reloading more efficient then recompiling as they mentioned only reload means no recompiling only reload?

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. .

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

    The compile-time and load-time address-binding methods generate identical logical and physical addresses. However, the execution-time address-binding scheme results in differing logical and physical addresses.

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

2

2 Answers

0
votes

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.

0
votes

Dynamic libraries (.dll .so) are relocatable, because they might appear at different adresses in different applications, but in order to save memory, the operating system only has one copy in physical memory (virtual memory is great), and each application has read only access.

Same happens for applications that are relocatable. For security, it is also wize that the addresses are random - some remote attacks are slighty harder