Hi,

I have recently gone through some C internal stuff, addressing schemes(logical,relocatable and physical).
what i dint get here is how are these inter-related.I do understand that these three are
genearated by different tools.

I want to know how exactly one is useful for other in executing the program in correct way.

Please HELP.


Regards,
Gaiety..

Its just one of the ways used within the working of a computer to make the best use of available space.
Say your program after compilation is converted into set of instructions like

Address Instruction
00000000 <Start>
00000001 <Instruction 1>
00000002 <Instruction 2>
00000003 <Instruction 3>
...
00000300 <End>

Here you can assume the program to be of 300 byte length and each instruction occupying 1 byte space. So the address you see beside an instruction is its logical address. Logical address has significance within the program. It can be viewed as an offset within a file.
Now this program has to be loaded on to the execution space within computer and there it would start from some address say ABCDEFAB , this is called the base address and adding the logical address of an instruction to this base address we get the actual "Physical address" of the instruction which is used by the CPU to execute that instruction.
This whole structure is relocatable as just by changing the base address physical address of the instruction changes.
This is the simplest way i could explain the above question and for more detailed knowledge you can build on this idea :)

Thanks Surfer, for your explanation.
I have few questions.

1) Is logical address anyway related to physical address?
what i mean here is, for a given logical address can we calculate the physical address .
if they are related how the compiler knows the calculated physical address will be free when the program is running .
if they are not related what is the significance of logical address.

sorry i am more confused here..or i am may be wrong in my analysis...

This article has been dead for over six months. Start a new discussion instead.