The programmer writes in source code and submits the
source code to the compiler. The compiler translates the source code to machine language, but since the compiler
has no way of knowing which address in any particular computer is the first available address (lower memory
may be occupied by operating-system code or another process), the compiler starts putting variables and
instructions at address zero. The file the compiler creates is called a relocatable file, because the addresses in
the file still need to be adjusted (relocated) before the code can be executed.
One approach to adjusting the relocatable addresses is to have the loader add the offset of the first available
memory location to all the addresses in the relocatable file. For example, if the compiler creates variable X at
location 100, and the first available memory for a user program is at location 1112, then the loader can adjust
the address of X in the executable file (machine code file) to be 1112 + 100.
In early computers without multiprogramming capability, a process executable, or ???image,??? was first created
by the loader. Then the image was loaded into memory, executed, terminated, and removed from memory.
One could execute a second program only after the first was completed.
Pages:
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318