Beruflich Dokumente
Kultur Dokumente
In most cases all the program translators on a particular system produce object programs in the same format.
Linking
Calling one function from another is based on knowing the address of each other function. Linking is simply the process of placing the address of a called function into the calling functions code. Static linking is used to combine multiple functions into a single executable module. This linking process takes place once when the executable module is created Linkage editors. Dynamic linking statically linked modules can contain references to functions that should be resolved during the execution. Linking loaders for implicit dynamic linking. Dynamic linker/loader for explicit dynamic linking
This process allows the programmer to override the standard subroutines in the library by supplying his/her own routines.
f1 f2
f3
Function name
Library
Linking loader
Library
Linkage editor
Memory
Linked program
A linkage editor produces a linked version of the program (load module), which is written to a file or library for later execution.
Simple Loader
Memory
Linkage editors
Advantages:
One linking and the most of relocation for many executions. Possibility to create subroutines libraries. Actual loading is very simple.
Disadvantages:
In recompiling for nearly every execution (program development). In infrequently used programs (storage waste).
Dynamic Linking
Dynamic linking (dynamic loading, load on call) postpones the linking function until execution time; a subroutine is loaded and linked to the rest of the program when it first called.
Additional advantages:
Applications with rarely used subroutines (f.e. errors handling) Application with a lot of possible services (f.e. mathematic packages)
Load-and-call ERRHANDL
User program
Load-and-call ERRHANDL
Bootstart Loaders
If the operating system loads the loader, how the operating system itself loaded into memory? Given an idle computer with no program in memory, how do we gets things started?
Memory empty no need for program relocation => OS kernel is loaded into a predefined location in memory by absolute loader
This absolute loader (bootstrap loader) may be a software function, resident in ROM or primary loaded by some hardware function.
In JVM, a class type is uniquely determined by the combination of the class name and class loader.
It is often desirable to upgrade software components in a long running applications such as a server.
old
Service
Server
new
Service
On the Java platform, this ability translates to reloading a subset of the classes already loaded in a running virtual machine.
Problems
There may be live objects that are instances of a class we want to reload. The application may be executing a method that belongs to a class we want to reload.
By organizing software components in separate class loaders, we can solve these problems.