.NET Framework CLR

In .NET, CRL (Common Language Runtime) is a heart of .NET Framework. Without CLR you can't imagine .NET Framework at all. When you write any program using any .NET language and run it, it won't run directly on your system. In order to run a program it is require to convert into binary so that operating system can understand and generate desire output.

Here it is important to understand that each system may have different system architecture and operating system. In order to run a program in any system, your program must be converted into the system specific native code. To do this CLR comes into the picture, which takes program source code as input, compile and convert into the MSIL (Microsoft Intermediate Language) which consists of CPU- independent code and instructions which is platform independent. At run time this MSIL again convert into system specific native code to run the program.

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.

CLR Run Time Environment

CLR Compiles application into the runtime, compile the IL code into native code, execute the code.

CLR Run Time Services

  • Memory management
  • MType safety
  • MEnforces Security
  • MException Management
  • MThread support
  • MDebugging support

CLR Architecture

  • Class loader - This will loads classes into CLR.
  • IL Compiler - Convert MSIL code into native code.
  • Code manager - Manages the code during execution.
  • Garbage collector - This performs automatic memory management.
  • Security engine - This enforces security restrictions as code level security folder level and machine level security.
  • Type checker - Enforces strict type checking.
  • Thread support - Provides multithreading support to applications.
  • Exception manager - Provides a mechanism to handle the run-time exceptions handling.
  • Debug engine - Allows developer to debug different types of applications.
  • COM Marshaler - Allows .NET applications to exchange data with COM applications.
  • Base class library - Provides the classes (types) that the applications need at run time.

CLR Features

The CLR has the following Features

  • Manages memory
  •     -Memory allocation
        -Memory De-Allocation (garbage collation)
  • Thread execution support
  • Code execution
  • Code safety verification
  • Compilation
  •     -Convert MSIL to Native Code
  • Code Security (granted permission to execute code. Code level, Folder level, Machine level)