Difference Between Program Compilation and Program Execution :

Program Compilation :

Compilation is a process undertaken by the compiler which compiles the code. A compiler is computer software that transforms computer code(Source code) written in one programming language (the source language) into another programming language. In other words the compiler is a translator that simply convert the program from one language to another language, from high-level language to machine level language. This conversion happens in the single shot and it creates an executable program. The process of compiling a code is known as compilation.

Program Execution :

The process of executing or running the executable program is called as execution. In the Execution process a computer performs all the instructions, which is available in the executable file. When the user double clicks a program file to run it, essentially the instruction bytes stored in the program file are copied into primary memory (RAM), and then the CPU is directed to begin running at the first instruction in that area of primary memory. The CPU runs instructions using a fetch-execute cycle: the CPU gets the first instruction in the sequence, executes it, then fetches the next instruction and executes it, and so on.

Differences :

Program Compilation Program Execution
1. The process of compiling a code is known compilation. The Process of executing a compiled program is known as program execution.
2. Compilation of program means converting the higher level language into machine understandable low level language (machine code). Execution of program means executing the instructions one-by-one, which is given in compiled binary file or executable file by the computer system.
3. In Compilation process, The compiler reads the program code or source code in one shot, translate it into machine level language and creates an executable program.In Program execution, First the operating system loads all the instructions of executable program in primary mamory or RAM, then the CPU will execute them one by one.
4. The Compilation process of a program code happens only once. We can execute a program as many time as we want.
5. The errors which occurs at time of compilation is known as Compile-time error.The errors which occurs at program execution is known as run-time or execution time error.
6. The compile-time errors is a bit easy to debug, because the user have access to source code of the program.The run-time errors are a bit hard to debug as compared to compile-time error, because the compiled binary is in machine language. And to debug compiled binary, the user will need special debugging software.

Next Topic :

No comments:

Post a Comment