- In previous post, we had discussed about Interrupt Mechanism performed by operating system. In this post we will look at different address binding schemes used by operating system to generate and manage addresses of the program instructions.
- Normally program is stored on disk as a binary executable file and it must be brought into memory for its execution.
- The process may keeps moving between disk & memory during its execution period depending on memory management scheme.
- The input queue contains a collection of processes on the disk waiting to brought into the memory for the execution.
- The normal procedure is to select one of the processes from the input queue and load that process into memory.
- During the execution the process access instruction and data from memory.
- On the completion, process terminates and memory space is released for other processes.
- Addresses may be represented in different way during these steps.
- Addresses in source program are as a symbolic constant. A compiler will bind these symbolic addresses in relocatable addresses or code.
- The linkage editor or loader will in bind these relocatable addresses to absolute addresses. (Such as 74014)
- Each binding is a mapping from one address space to another address space.
Address Binding Schemes
- If it is known in advance that where the process will be placed in memory then absolute code can be generated at the time of compilation.
- If we know in advance that a user process may store at starting from location R and that the generated code will start at that location and extend up from there.
- If at some later time starting location changes then it will be necessary to recompile this code.
- Ms-dos based dot com format programs are absolute code and bound at compile time.
- If it is not known at compile time that at which particular location the process will reside in memory when the compiler will generate relocatable code to find the address.
- In this case final binding is delayed until load time.
- In this case absolute address will be generated by the loader at the load time
Execution Time (Run Time):
- If the process can be moved during its execution from one memory segment to another then address binding must be performed at run time.
- A special hardware-MMU (Memory Management Unit) is used to generate physical addresses.
- For more detail on address translation please read our post “Logical and Physical Address”.