Background Working of C# program
Before proceeding towards the detailed background working of a C# program we should know some important parts of it which are as follows:-
Source Code
Compiler
Metadata
Assembly
Class Loader
JIT Compiler
Native Code
Now we will discuss all the parts one by one of background working in detail:-
Source Code:- It can be defined as the set of instructions which is provided to the system to perform the task. It is always in the form of text. As text is in human readable format which is not understood by system so the need of compiler arises .
Compiler:- It works as the translator which translate the source code(text format) into the machine language i.e intermediate language. Simple text can not be understood by the system that’s why compiler is needed to translate the text language into machine language. In c# the intermediate language is known as MSIL.(Microsoft Intermediate Language).
Metadata:- It can be defined as data about data. Metadata includes the whole data which a class contains. for example :-data types,variable,methods etc. all the data which is used in a class comes under metadata.
Assembly:- Assembly is a self describing unit. It is a combination of metadata and MSIL(Microsoft Intermediate Language). As within the assembly all the information regarding class data and intermediate language is present so automatically assembly tells everything about the program that’s why it is defined as self describing unit.
Class Loader:- It is required to load the classes of a program into the memory. Without loader class can not be loaded and further processing will not be possible.
JIT Compiler:- As compiler is needed to translate source code into the intermediate language(i.e binary format) similarly JIT complier is required to translate intermediate language into the human readable format. As intermediate language is understood by system only so it is not possible for the user to understand the intermediate language. User can understand the text format output so this compiler is needed.
Native code:- This is the output of any program which is get executed. If we have used pointers with in the program so the native code will be known as unmanaged code where as if pointers are not used so that code will be known as managed code.
Now actual working get started as first of all source code will be written in the IDE(Integrated Development Environment). When this program came at run time compiler converts the source code into the Microsoft intermediate language. Assembly is also automatic created when compiler converts the source code into MSIL.
After the conversion class loader will load the class for further processing. JIT compiler after processing the data convert intermediate language into the managed or unmanaged code according to the use of pointers with in the program. At last but not the least we will get the native code which is output of the program.
0 Comment(s)