Common language runtime  (CLR)

CLR is also referred to as a "Managed environment".

The main components of CLR are:-
  • Common type system.
  • Common language specification.
  • Garbage collector.
  • JIT [Just-in-time] compiler.


The CLR's JIT compiler converts the MSIL [Microsoft intermediate language] code into native code or machine code.
The common type system is responsible for understanding all the data type system of .Net programming language and convert them into CLR understandable format.
The CLS provides the language interoperability.

common language runtime clr


Functions of CLR 

  • It converts program into native code.
  • Handles exceptions.
  • Provides type safety.
  • Memory management.
  • Provides security.
  • Improved performance.
  • Language independent.
  • Platform independent.
  • Garbage collection.
  • Provides language features such as inheritance, interfaces and overloading for OOPs.

Components of CLR

  1. Base Class Library Support :- It is a class library that provides support of classses to .Net application.
  2. Thread Support :- It provides parallel execution of code through classes and interface.
  3. COM Marshaler :- Helps in communication between COM object and the application.
  4. Type Checker :- Type checkers like CLS OR CTS will verify types used in the application standard supported by CLR. This provides type safety.
  5. Exception Manager :- Provides exception handling at runtime to avoid application failure.
  6. Security Engine :- Provides code-level security,  folder-level security and machine-level security.
  7. Debug Engine :-  Allows debbugging and trace the execution of code.
  8. MSIL To Native Code :- Converts MSIL to native code [JIT Compilation].
  9. Code Manager :- Manager code execution at runtime. 
  10. Grabage Collector :-  Provides automatic memory management of unused object in an app.
  11. Class Loader :- It is used to load all the classes at runtime.