Overlays(覆盖技术) Keep in memory only those are needed at any given time. Symbol table 20k P Needed when process is larger than amount of memory allocated to it. Common 30k Implemented by user,no special routines support needed from OS, programming design of overlay Overlay driver 10k structure is complex 70k Pass 1 Pass 2 80k Overlays for a two-pass assemble 4口148:4在,4生,月QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Overlays (覆盖技术) ▶ Keep in memory only those are needed at any given time. ▶ Needed when process is larger than amount of memory allocated to it. ▶ Implemented by user, no special support needed from OS, programming design of overlay structure is complex Symbol table 20k Common routines 30k Overlay driver 10k Overlays for a two-pass assemble 70k Pass 1 Pass 2 80k
Program linking source files compiling object modules linking. loadable modules according to the time of linking 1.static linking(静态链接方式) 2.load-time dynamic linking(装入时动态链接) 3.run-time dynamic linking(运行时动态链接) 4口”4814在,4色,主)QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program linking ▶ source files compiling −−−−−−−−→ object modules linking −−−−−−→ loadable modules ▶ according to the time of linking 1. static linking (静态链接方式) 2. load-time dynamic linking (装入时动态链接) 3. run-time dynamic linking (运行时动态链接)
Program linking 1.static linking(静态链接方式) Before loading,all object modules and required libraries are linked into one loadable binary program image. In object modules and(static)libraries:relative address Exist external calls or references to external symbols (functions or variables): object modules object modules;object modules →libraries While linking: relative addresses are modified: multiple relative address spaces one relative address space External calls and references are deliminated Disadvantage: Each program on a system must include a copy of required libraries (or at leasted required routines) Example:language libraries 4口148:4在4生,主月QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program linking 1. static linking (静态链接方式) ▶ Before loading, all object modules and required libraries are linked into one loadable binary program image. ▶ In object modules and (static) libraries: relative address ▶ Exist external calls or references to external symbols (functions or variables): object modules ←→object modules; object modules →libraries ▶ While linking: ▶ relative addresses are modified: multiple relative address spaces → one relative address space ▶ External calls and references are deliminated ▶ Disadvantage: Each program on a system must include a copy of required libraries (or at leasted required routines) ▶ Example: language libraries
Program linking 2.load-time dynamic linking(装入时动态链接) Linking while loading: External calls and references are deliminated According to external calls and references,the loading program find the required object modules and libraries, and load them into memory Relative addresses are modified: multiple relative address spaces-one relative address space Advantage: Easy to modify and update the object modules and libraries Easy to share the object modules and libraries 4口”484在4色,主月QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program linking 2. load-time dynamic linking (装入时动态链接) ▶ Linking while loading: ▶ External calls and references are deliminated According to external calls and references, the loading program find the required object modules and libraries, and load them into memory ▶ Relative addresses are modified: multiple relative address spaces → one relative address space ▶ Advantage: ▶ Easy to modify and update the object modules and libraries ▶ Easy to share the object modules and libraries
Program linking 3.Dynamic Linking(运行时动态链接) Every execution time,the set of executed modules of a program may different load all?on demand? Linking postponed until execution time While linking: A stub is included in the image for each library-routine references The stub is a small piece of code,used to locate the appropriate memory-resident library routine During execution: Stub replaces itself with the address of the routine,and executes the routine OS needed to check if routine is in processes'memory address Dynamic linking is particularly useful for libraries- shared libraries Advantage: short load time;less memory space 4口”4814三4色主刀QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program linking 3. Dynamic Linking (运行时动态链接) ▶ Every execution time, the set of executed modules of a program may different ▶ load all? on demand? ▶ Linking postponed until execution time ▶ While linking: ▶ A stub is included in the image for each library-routine references ▶ The stub is a small piece of code, used to locate the appropriate memory-resident library routine ▶ During execution: ▶ Stub replaces itself with the address of the routine, and executes the routine ▶ OS needed to check if routine is in processes’ memory address ▶ Dynamic linking is particularly useful for libraries – shared libraries ▶ Advantage: ▶ short load time; less memory space