Does the assembler choose where a program object file is stored in memory?

38 Views Asked by At

My textbook (Computer Organization by Hamacher et al.) says the following:

The loader transfers the object program from the disk into a specified place in the memory. It must know the length of the program and the address in the memory where it will be loaded. The assembler usually places this information in a header in the object file, preceding the machine instructions and data of the object program.

It adds on and somewhat reiterates later with this:

Once the object program has been loaded into the memory, the loader starts its execution by branching to the first instruction to be executed. In the source program, the programmer indicates the first instruction with a special address label such as START. The assembler includes the value of this address label in the header of the object program.

Now my question is the following: if the above is correct, how does the assembler know what address/value to assign to the label START? I am very much a novice when it comes to ideas about virtualization and the OS but I imagine it goes something like the assembler asking the OS where in the address space there might be enough space for the program's object file?

0

There are 0 best solutions below