FOR FREE MATERIALS

Execution of Program and Object Code

 

Before we know how processes are managed in the main memory by memory management, here we first discuss how processes are compiling, linking, loading, and finally ready binary code for execution. 

A program written in any language has to be transformed before it can be executed. Several step transformations perform memory binding—each one binds the instructions and data of the program to a new set of addresses.

 

 

Here object code is binary code but it is not executable code i.e not ready for execution. 

 

As if we know that compiler gives us ready executable binary code after compiling the source code but 

The compiler software is actually combined inside the assembler along with the loader and linker as a whole. 

 

But in practical compiler only gives assembly code and then the assembler produces object code from the output of the compiler

 

Important note:  Assembler is hardware depended so, object code will be created as per hardware.

 

Object Code:

Object code resides at secondary memory (hard disk) and it has several areas where it stores different information. The general structure of object code as below:

 

 

1. Header

The header section works as an index of the object file where it can get all the details about what information store in which section.

 

2. Text Segment: It contains the set of all instructions of the program.

 

3. Data Segment: It contains all the data which we used in the program like any constant variable.

 

4. Relocation Information:

The concept of relocation is coming from assigning an address to each instruction of the program. 

 

The process of assigning addresses to various instructions of the program at the time of loading and as per address make an adjustment the instruction in the program to reflect the assigned address is called relocation

 

Note: Please continue Relocation Information elaborately in the next topicAddress Relocation