Reputation: 3518
There are different ways by which OS know how to locate a particular piece of code in the physical storage.How does it convert the logical memory to physical location?
Upvotes: 0
Views: 10514
Reputation: 11
Found very good explanation here.
Summarising below:
Logical memory/address is converted to physical location/address using following types of address binding (depending upon when is the binding/conversion happening):
If program's final location in physical memory is known at compile time then binding can happen at compile time itself, only caveat is that program needs to be recompiled anytime its physical memory location changes.
If program's final location in physical memory is "not" known at compile time then compiler generates relative addresses or relocatable address in terms of offsets from the starting location of the program(for e.g., 32 bytes from starting location). This relocatable address is then bound by loader to absolute addresses in physical memory when it loads the program into any process into the main memory. Now if the starting location changes then program does not need to be "recompiled" but only needs to be "reloaded".
Execution time binding happens only in the cases where process can move from one physical memory segment to another at execution time.
Upvotes: 1
Reputation: 3518
The binding is necessary to link the logical memory to the physical memory.To know where the program is stored is necessary in order to access it.The binding may be of three different types.
Upvotes: 2