How at execution time address binding is done in OS?
I am readin Galvin's 开发者_运维百科Operating System book. In memory management's address binding it said about 3 types of address binding. compile time, load time, execution time. And about Execution time address binding:" The physical address are computed at the time of execution." But my question is that these computations for the physical address is for the memory's base address to load the process into memory. To execute the process first it has to be loaded into memory. For that it requires some physical memory address. Then how at execution time these addresses are computed? I am confused.
Can some provide explanation for this.
Thanks
You are correct in your thinking. The difference between load-time and run-time binding is that in run-time every time there is a memory lookup it goes through a "relocation register" which is like the base register and then you add an offset.
In load-time binding it does the same thing but subsequent lookups don't require evaluation of this register. The addresses are set when it is first pulled into memory. Hence if the base address changes you need to re-load the whole process to fix up all the relocatable addresses.
In the case of run-time, you can move the process around in physical memory and not need to worry about re-loading it to fix the mapping up because every time there is an access to memory it maps it then.
Load-time binding results in matching logical/physical addresses but run-time results in differing logical/physical addresses.
I hope this is clearer for you. I've just started learning about Memory Management too :)
When it says that the actual base address is generated at execution time it means that that the address in RAM (physical address) is determined at execution time from the virtual address using the MMU. This whole address conversion is done on the fly. For executing the process the starting virtual address has to be known. When the process is to be run its virtual page table is loaded in the MMU and then the MMU quickly calculates the physical address(in RAM) and the execution goes on with MMU generating physical addresses from page tables. Consider reading Tanenbaum's Modern Operating Systems. I find it better.
Execution time address binding usually only applies to variables in programs and is the most common form of binding for scripts, which do not get compiled. In this scenario, the program requests memory space for a variable in a program the first time that variable is encountered during the processing of instructions in the script. The memory will be allocated to that variable until the program sequence ends, or unless a specific instruction within the script releases the memory address bound to a variable.
精彩评论