The Common Language Runtime (CLR) is a run time engine thatmanages .Net code (such as C# applications).It works as a layer betweenoperating system and the applications written in .net language. The mainfunction of CLR is to convert the manage code into the native code and thenexecute the program. The manage code compiled only when it needed, that is itconvert the appropriate instructions when each function is called.


Common Language Runtime’s main task is to convert the .NetManage code into native code, manage running code like a virtual Machine andalso control the interaction with the operating system.

 It Provides features such as…

*Memory Management
*Thread Management

*Type safety


*Robustness, Exception Handling

*code Management, Garbage Collection

Common Language Runtime:

                                         Common Type system

Intermediate Language(IL)

To Native Code compilers

Execution Support


           Garbage Collection, Code Manager

            ClassLoader and Memory Layout

Working of CLR: When the .net program is compiled,the output of the compiler is not an executable file but a file that contains aspecial type code called the Microsoft Intermediate Language (MSIL now calledCIL, common intermediate Language). The CLR to translate this Intermediate codein to a executable code when the program is executed making the program to runin any environment for which the CLR is implemented. This MSIL is turned intoexecutable code using JIT (Just in Time) compiler. When .Net programs areexecuted, the CLR activate the JIT compiler. The JIT compiler converts MSILinto native code on a demand basis as each part of the program is needed. Thusthe program executes as a native code even through it is compiled into MSILmaking the program to run as fast as it is compiled to native code but achievesthe portability benefits of MSIL.

  Modified On Sep-18-2014 01:23:52 PM

Leave Comment