Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Address binding generate same address

Why compile time & load time address binding generate identical physical and logical addresses while execution time address binding generate different physical & logical addresses?

like image 534
Green goblin Avatar asked Jun 20 '12 12:06

Green goblin


1 Answers

It has been long since this question was asked but I am just adding the answer for archiving purposes.

Let us have a look at the following definition:

Logical address: Address generated by CPU

Physical address: Addresses as seen by memory-management unit(MMU)

Now in compile time binding we assume that a range of memory location will always be available(which is sufficient for the program) and absolute code is generated. So whatever addresses CPU generates(like pointer addresses etc.) are same as what is seen by MMU.

A better version of memory utilization is to delay binding till the load time so that the memory is not used used by the program sitting on disk. For this the code generated in relocatable format. This is load time binding.

Now execution time binding is a bit different where binding is delayed till execution time. In this case the CPU generates an address, let us say 300, and do all manipulation on address 300 but whenever there is an actual memory access this address is transformed by adding the value of relocatable register, let us say R, to this address. So logical address range is 0-LIM while physical address space is R-(R+LIM).

Let me also explain it with an example so that it becomes more clear:

Consider swapping if you swapped a program with load time binding you need to swap it back to the same location(as all addresses in the instructions were bidden according to this address) while in execution time binding you can swap back any process to any place because you only need to change the value in the relocatable register and it will just work fine. Hence increasing memory utilization.

like image 152
Aman Deep Gautam Avatar answered Sep 27 '22 15:09

Aman Deep Gautam