Roles of Common Language Runtime (CLR) in .NET

 

About CLR

CLR (Common Language Runtime) is a heart of Dot Net Framework.


It is a core runtime environment of .NET Framework for executing applications. The main function of Common Language Runtime (CLR) is to convert the Managed Code into native code and then execute the Program. It acts as a layer between Operating Systems and the applications written in .Net languages.


CLR handles the execution of code and provides useful services for the implementation of the program. In addition to executing code, CLR provides services such as memory management, thread management, security management, code verification, compilation, and other system services.

Role of CLR in DOT.NET Framework


Base Class Libraries: It provides class libraries supports to an application when needed.
MSIL Code to Native Code: The Common Language Runtime is the engine that compiles the source code in to an intermediate language. This intermediate language is called the Microsoft Intermediate Language.


During the execution of the program this MSIL is converted to the native code or the machine code. This conversion is possible through the Just-In-Time compiler. During compilation the end result is a Portable Executable file (PE).


Thread Support: Threads are managed under the Common Language Runtime. Threading means parallel code execution. Threads are basically light weight processes responsible for multi-tasking within a single application.


COM Marshaler: It allows the communication between the application and COM objects.


Code Manager: CLR manages code. When we compile a .NET application you don't generate code that can actually execute on your machine. You actually generate Microsoft Intermediate Language (MSIL or just IL). All .NET code is IL code. IL code is also called Managed Code, because the .NET Common Language Runtime manages it.


Debug Engine: CLR allows us to perform debugging an application during runtime.

Common Language Specification (CLS) :
CLS use to communicate Objects written in different .Net languages.
Common Language Specification (CLS) defines the rules and standards to which languages must adhere to in order to be compatible with other .NET languages. This enables C# developers to inherit from classes defined in VB.NET or other .NET compatible languages.

CTS (Common Type System):
It specifies data types which are created in two different languages get compiled in to base common data type system.

Type Checker
Type checker will verify types used in the application with CTS or CLS standards supported by CLR, this provides type safety.

Exception Manager:
Exception Manager will handle exceptions thrown by application by while executing Try-catch block provided by an exception.
In "Try" block used where a part of code expects an error
In "Catch" block throws an exception caught from "try" block, if there is no catch block, it will terminate application.


Security Engine: It enforces security permissions at code level security, folder level security, and machine level security using Dot Net Framework setting and tools provided by Dot Net.


Garbage Collector
Garbage Collector handles automatic memory management and it will release memory of unused objects in an application, this provides automatic memory management.

 

 

:: SHARE THIS POST ::

        
 
Author: Gurunatha Dogi
is a software engineer by profession and founder of Onlinebuff.com, Onlinebuff is a tech blog which covers topics on .NET Fundamentals, Csharp, Asp.Net, PHP, MYSQL, SQL Server, Cell Phones and lots more. Follow me @ and twitter.
Leave a Comment......

All fields marked with * are mandatory

bpjgj

 

 
Comments

Posted by Junaid Ali on 2015-06-03

Good Job Dude (Y)

Posted by Pooja on 2014-12-23

I wish my faculty would have read it... Its simply Awesome , convincing and satisfactory

Posted by SANTHOSH on 2014-12-03

need examples about jquery and javascript in real time project ,,Kindly help us

Posted by Kiran on 2014-10-10

simple and clean explanation

Posted by Ravi kumar gr on 2014-07-14

thanks brother for your help if i get job i message you wish me good luck...

Posted by Mahpara on 2014-05-12

very informative site.i want to join this site