What is the Program execution cycle?
Program execution cycle
Q)Explain the program execution cycle with a diagram.
Q)Explain the compiler, linker and loader.
The execution cycle of a typical program goes through the following steps.
Source code on Program execution cycle
- The first step of program development starts with writing the source code in an editor like Turbo C. This source code is saved with the .c extension. E.g. “hello.c”
The compiler on the Program execution cycle
- The compiler is the translating program that converts a high-level language program into a low-level language program.
- A ‘C’ program is a high-level program, this program is not understandable by computer directly. A computer only understands the binary language i.e. low-level language.
- Hence in order to run the ‘c’ program, it must be converted into the binary form, this task is done by the compiler.
- The compiler takes the source file (hell.c) as input and generates the object code (hello.obj) as the output. This object code is the binary code of the program source code.
Linker on Program execution cycle
- The linker performs the important task of linking together several object modules. The need for a linker arises when a particular program is made up of several object modules.
- The original source program may be in a high-level language. Once they are converted into machine code, they must be linked together to be executed as a single program.
- The linker, after linking all object modules together gives the single executable file. which is ready for execution.
Loader on Program execution cycle
- The task of loading the linked object modules is performed by a loader. The loader actually loads the executable code from secondary memory to primary memory.
- There are two types of loaders depending on the way the loading is performed: Absolute loaders and relocating loaders.
- The absolute loaders load the executable code into the memory location specified in the object modules. Relocating loaders, on the other hand, load the object code into memory locations which are decided at load time.