The Lifecycle of a Program
Let’s look at the phases a computer program undergoes from creation to execution.
As we have learned, a computer’s CPU can only understand and execute machine code instructions. However, programmers seldom write machine code. Instead, they usually make use of high-level languages like C++ and Python to write code, which is then translated to machine code by the CPU. Hence, a program written in a high-level language undergoes various phases throughout its lifecycle. However, the translation steps vary for
Phases of a program written in compiled languages
Source code creation
A programmer writes code in a high-level language of their choice.
Object file creation
The code that the programmer writes goes to a program called the compiler, which checks it for syntax errors. The compiler then creates a file known as the object file that contains the machine code instructions corresponding to the high-level language.
Executable file creation
Complex programs are usually written in multiple files. A program called the linker takes in the object file and links it to the other relevant files to produce the executable file.
Get hands-on with 1400+ tech skills courses.