7.1 Memory Management Requirements 7.1.1 Five requirements .7 1.2 Preparing program for Execution
12 7.1 Memory Management Requirements • 7.1.1 Five requirements • 7.1.2 Preparing Program for Execution
7.1.2 Preparing program for Execution(1/ 9) Program Transformations Translation(Compilation Lin king Loading Iranslation Linking Loading Execution source object module 1 module 1 source bice module 2 module 2 module module (in secondary (in main memorv) memory) sourcc bice module n module n
7.1.2 Preparing Program for Execution(1/9) • Program Transformations • Translation (Compilation) • Linking • Loading 13
7.1.2 Preparing program for Execution( 2/ 9) .A Sample Code Segment static int gVar; int proc a(int argi gVar=7 put record(gvar
7.1.2 Preparing Program for Execution(2/9) • A Sample Code Segment 14 ... static int gVar; ... int proc_a(int arg) { ... gVar = 7; put_record(gVar); ... }
7.1.2 Preparing program for Execution (3/9) The relocatable object module Code segment Relative Address Generated Code 0000 Data Segment 0008 entry proc a Relative Address Generated variable space 0220 0224 store R1,0036 0036 [Space for gVar variable] 0228 push 0036 0232 call put record' (last location in the data segment) 0400 External reference table 0404 put record′ 0232 0500 External definition table 0540 proc a′0008 0600 (symbol table) 0799 (last location in the code segment)
7.1.2 Preparing Program for Execution(3/9) • The Relocatable Object module 15
7.1.2 Preparing program for Execution (4/9) The absolute Program Code Segment Relative Address Generated Code 0000 (Other modules entry proc a Data Segment Relative 1220 =7,R1 store R1,0136 Address Generated variable space 1228 push 1036 1232 0136 Space for gVar variable] call 2334 1000 1399 (End of proc a) (last location in the data segment) (Other modules) 2334 entry put record 2670 (optional symbol table) 2999 last location in the code segment)
7.1.2 Preparing Program for Execution(4/9) • The Absolute Program 16