2,652 views
0 votes
0 votes
Why logical address and physical address are same in case of compile and load time binding ?

In complie time as i have read compiler will generate absoute address ,but this adress for the meain memory location.Logical address can be anything?Why it has ti be same as physical address?

1 Answer

1 votes
1 votes
Brief overview of Logical & Physical address.

LOGICAL ADDRESS

It does not have a physical existance like physical address. It is the address generate by CPU in perspective of a program, for this reason it is also called as VIRTUAL ADDRESS.

 

PHYSICAL ADDRESS

It is the physical memory address(physical existance)  in main memory or you can say address of a cell of main memory.

Now for COMPILE TIME ADDRESS BINDING, compiler knows the address to which program WILL reside in main memory & so while compilation, it will  bind the code with those absolute addresses. CPU when generate logical address(in prespective of a program) will be same as physical address as no translation is required.

In LOAD TIME ADDRESS BINDING, Compiler have to delay the binding till load time as it does not know to which address program will reside in main memory so it will bind the code with RELOCATABLE address. Later while loading the program to MM, loader will resolve these relocatable address to absolute address. Here also, the logical & physical address is same just addition of realocation factor is required to logical address & we'll have absolute physical address. Remember logical address always exists in perspective  of a program.

To know Further why both are same in case of compile time & load time you need to understand why both are not same in case of run time binding.

hope this answer will help.

Suggestions & doubts are welcome.

Related questions

0 votes
0 votes
1 answer
3