Search content within the blog

Wednesday, December 3, 2008

CLR and Its Functions

CLR is a Common Language Runtime . As the name suggests it's Common Runtime to all dotnet related languages like Vb,C#,VC++ ,J# etc.

When ever we compile any application in dotnet the corresponding langauge compiler will take care of it and convert into MSIL(Microsoft Intermediate Language) code , CLR will handle the code and convert into operating system native code with the help of JIT(Just In Time) compiler.There are many components in CLR which are used to do specific tasks or functions of CLR.

Functions of CLR
Good toolsupport
Components in CLR
The above functionalities achieved by all these componets .Each component is responsible for specific functionality.

1.Class Loader:
It is used to load all the classes at runtime

2.MSIL to native Compiler:
It is a JIT (Just In Time) compiler it will convert MSIL code to native code

3.Code manager:
It manages the cade during runtime

4.Garbage Collector:

It manages memory .It collects all the unused objects in the memory and deallocate them when the memory is less.

5.Security Engine:
It has all the security restrictions.

6.Type checker:

It enforces strict type checking.

7.Thread support:

It provides multithreading support to our application.

8.Exception manager:

It provides mechanisum to handle execptions at runtime.

9.Debug Engine:

Which allows you to debug applications.

10.Com Marshaler:

Which allows interoperability to our applications

11.Base class library support:

Which provides all types that application need at runtime

Advantages of CLR and MSIL Code

Platform Independency
Architecture Independency
Language Independency
Managing the memory using Garbage Collector

The runtime automatically handles object layout and manages references to objects, releasing them when they are no longer being used. Objects whose lifetimes are managed in this way are called managed data. Garbage collection eliminates memory leaks as well as some other common programming errors.

Following are some benefits of the runtime:

1.Performance improvements.
2.The ability to easily use components developed in other languages.
3.Extensible types provided by a class library.
4.New language features such as inheritance, interfaces, and overloading for object-oriented programming; support for explicit free threading that allows creation of multithreaded, scalable applications; support for structured exception handling and custom attributes.

Additional runtime features include:

1.Cross-language integration, especially cross-language inheritance.
2.Garbage collection, which manages object lifetime so that reference counting is unnecessary.
3.Self-describing objects, which make using Interface Definition Language (IDL) unnecessary.
4.The ability to compile once and run on any CPU and operating system that supports the

Note:CLS and CTS are the specifications not components of CLR

No comments:

Post a Comment