Operating System Lecture14
Operating System Lecture14
Designed by
Mr. Prithwish Das
Assistant Professor
CSE, NSEC
Address Binding
Address binding is a mapping from one address space to another. There are three
types of address binding
1. Compile time address binding
2. Load time address binding
3. Execution time address binding
1. Compile time address binding
During the compilation the absolute address will get embedded in the executable code. That is the
program knows from which address it is actually to get loaded and from where it is actually get executed.
( logical and physical both addresses are same)
Minimum setup time is the one of the advantage of compile time address binding.
The disadvantage of this address binding is if the target memory space is preoccupied by any other
program. Collision will take place . The current program will overwrite the previous program.
2. Load time address binding
When the program will get compiled then all the addresses will be in relocatable addressing format. Take
an example suppose in compile time the starting address of a program is 0 and ending address is 3000
(logical address). During the loading time the memory address from 2000 onwards are available. So 0
will be mapped into the memory address 2000 (0+2000) and 3000 will be mapped into 5000
(2000+3000). Actual loading addresses (Physical address) are from 2000 to 5000.
The advantage of this address binding is here never overlap will be occurred because of mapping into
free memory address space.
The disadvantage is it is slower than compile time address binding.
Address Binding contd.
3. Execution time address binding
During the execution the program can be moved from one memory block to another memory
block if it is allowed. After getting the physical address space in load time address binding it can
be moved to another free physical address space during runtime.
The advantage of this address binding is it is more dynamic.
The disadvantage it takes much more time.
Multistep processing of a user program
Source
program
compiler or Compile
assembler time
Object
Other Module
object
modules
Linkage editor
Load
System load time
library Module
Dynamically loader
loaded system
library
In-memory binary Execution
Dynamic
memory image time (run
linking
time)
Dynamic loading
• Programs are divided into different modules.
• To execute the program all the modules are not
required at the same time.
• Before the module is called there is no need to load
the module into the primary memory.
• Dynamic loading says that load the main module first
• Load the other modules when they will be required.
• Those modules will be required in near future they will
be loaded (dynamically) into the primary memory
when they will be called.
Dynamic Linking
• Modules of the program requires many functions.
• The body of the system defined functions are stored into the system libraries.
• When the respective function will be called then only the respective library
routine will be loaded into the memory for executing the body of the function.
• The library routine is not loaded into primary memory prior until and unless
the modules are executing the body of the function.
• The particular segment of code is called stub which will hold the required
information for executing the body of a function which library routine is
required and where does this library routine is located.
• Suppose there is a conditional statement. If condition is true then execute
function1 else function2.
• There is no need to link both function at the same time.
• Depending upon the out come of the conditional statement required library
function will be linked.
Overlays
For a assembly language program
Symbol table 20K
to generate machine level
language assembler is required.
Take an example where two stage
Common
30K assembler (pass 1 and pass 2) is
routines
required. The size of the
components are as follows:
Overlay driver 10K
Pass 1 70 KB
Pass 2 80 KB
Symbol table 20 KB
70K pass1 pass2 80K
Common routines 30 KB