Loading, please wait...

A to Z Full Forms and Acronyms

Common Language Runtime

In this article you will learn about CLR

Why CLR is called as heart and soul of .NET

CLR (Common language runtime)

The .NET Framework provides a runtime environment called the common language Runtime or CLR. It is the soul and heart of .NET framework. It manages the execution of code and provides services that make the execution of code easier.

“Runtime” means that code is running which is another way of saying it is being executed. “common language” means that this runtime manages the execution of code written in several language that share the services provided. The CLR or the .NET runtime serves as the execution engine of .net programs execute under the control of the CLR. In addition code, CLR provides services such as memory management, thread management, security management, code verification, compilation, and other system services. It enforces rules that in turn provide a robust and secure execution environment for .net applications.

The common language runtime (CLR) serves many roles within the .net system. It provides an environment to execute .net application on target machines.

The CLR serves as the execution engine of .net framework all .net code irrespective of their programming language, because the compilers of .net framework convert every source code into a common language known as MSIL. CLR also provides various services to execute processes, such as memory management service and security services.

CLR performs various tasks to manage the execution process of .net applications. It enforces rules that in turn provide a robust and secure execution environment for .net applications.

Services provided/Responsibilities/Role/Functions of CLR

Services provided/responsibilities/role/functions of CLR are the following:

1. Automatic memory management

2. Garbage collection

3. Exception manager

4. Code access security

5. Thread support

6. Code verification

7. Tool support

8. Code manager

9. JIT compilation of .net code

10. Multi-language support



1. Automatic memory management:-

CLR provides efficient and automatic memory management. CLR invoke various built-in functions of .net framework to allocate and de-allocate the memory of .net objects. Therefore, programmers need not write the code to explicitly allocate and de-allocate memory to programs.

2. Garbage collection:-

Garbage collection is the major role of CLR which prevents memory leaks during execution of programs. The garbage collector of CLR automatically determines the best time to free the memory, which is reserved by an object for execution.

3. Exception manager:-

Exception manager will handle exception thrown by application while executing Try-catch block provided by an exception.

4. Code access security:-

Code access security is used in .net framework to impose restrictions and security during execution of programs.

5. 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.

6. Code verification:-

CLR enforces type safety and prevents a source code from performing illegal operations, such as accessing invalid memory locations.

7. Tool support:-

The CLR works hand-in-hand with tools like visual studio, compiler, debuggers and profilers to make the developers job much simpler.

8. Code manager:-

CLR manages code when one compile a .net application the code is not generated that can actually execute on the machine.

9. JIT compilation of .net code:-

CLR uses JIT and compiles the MSIL code to machine code and then executes. CLR also determines depending on platform what is optimized way of running the MSIL code.

10. Multi-language support:-

CLR provides multi-language support by managing the compilers that are used to convert source to intermediate language and from IL to native code, and it enforces program safety and security.

Benefits of CLR

The CLR provides the following benefits:

  • provides the ability to use components developed in other languages.

  • Improvement in performance

  • provides object-oriented features such as inheritance, interfaces and overloading for object-oriented programming.

  • Automatic memory management by garbage collection.

  • Provides thread execution management

  • security enforcement.

  • The base class library provides extensible provides extensible types.

  • Support use of delegates instead of function pointers for increased type safety and security.

  • Provides support for structured exception handling.

 



A to Z Full Forms and Acronyms