Вы находитесь на странице: 1из 5


Normally the Cs program building process involves some stages and
utilizes different tools such as a Preprocessor, Compiler, Assembler, and Linker,
Loader. These stages are defined and graphically illustrated below;

Preprocessing; It processes include-files,conditional compilation instructions.

They instruct compiler to do required pre-processing before actual compilation.
We can call this phase text substitution or interpreting special preprocessor
directives denoted by #.

Fig; showing stages involved in Cs program building process

Compilation; Compilation is a process in which a program written in one

language get translates into another targeted language, If there are some error,
compiler will detect them and report error.

Compiler: It takes the output of the preprocessor, and the source code,
and generates assembler source code. It is a program which translates a high level
language program into a machine language program. It checks all kinds of limits,
ranges, errors etc. But its program run time is more and occupies a larger part of
the memory. It has slow speed. Because a compiler goes through the entire
program and then translates the entire program into machine codes. If a compiler
runs on a computer and produces the machine codes for the same computer then it
is known as a self compiler or resident compiler. On the other hand, if a compiler
runs on a computer and produces the machine codes for other computer then it is
known as a cross compiler.

Assembly; In this stage Assemble code get translated into machine code, we can
call assembler a special type of complier.
Assembler: A computer will not understand any program written in a
language, other than its machine language. The programs written in other
languages must be translated into the machine language. Such translation is
performed with the help of software. A program which translates an assembly
language program into a machine language program is called an assembler. If an
assembler which runs on a computer and produces the machine codes for the
same computer then it is called self assembler or resident assembler. If an
assembler that runs on a computer and produces the machine codes for other
computer then it is called Cross Assembler.

Fig; steps involved Cs program building process

Linking ;If the piece of code need some other source file to be linked then linker
link them to make it a executable file.It takes one or more object files or libraries
as input and combines them to produce a single (usually executable) file. In doing
so, it resolves references to external symbols, assigns final addresses to

procedures/functions and variables, and revises code and data to reflect new
addresses (a process called relocation).
Linker: In high level languages, some built in header files or libraries are
stored. These libraries are predefined and these contain basic functions which are
essential for executing the program. These functions are linked to the libraries by
a program called Linker. If linker does not find a library of a function then it
informs to compiler and then compiler generates an error. The compiler
automatically invokes the linker as the last step in compiling a program.
It has three tasksA. It searches the program to find library routines used by program, e.g. printf(),
math routines.
B. Determines the memory locations that code from each module will occupy and
relocates its instructions by adjusting absolute references.
C. Resolves references among files.
The last step is loading ;
Loader: It loads the executable code into memory.Program and data are
created, register get intialized. Loader is a program that loads machine codes of a
program into the system memory. In Computing, a loader is the part of an
Operating System that is responsible for loading programs. It is one of the
essential stages in the process of starting a program. Because it places programs
into memory and prepares them for execution. Loading a program involves
reading the contents of executable file into memory. Once loading is complete,
the operating system starts the program by passing control to the loaded program
code. All operating systems that support program loading have loaders. In many
operating systems the loader is permanently resident in memory.
Steps involved are A. Read executable files header to determine the size of text and data segments.
B. Create a new address space for the program.
C. Copies instructions and data into address space.
D. Copies arguments passed to the program on the stack.
E. Initializes the machine registers including the stack.

F. Jumps to a startup routine that copies the programs arguments from the stack
to registers and calls the programs main routine.


M.TECH 1st year (Digital System)
Reg. No. 2016043104
Roll No 04