Share via


.Net Framework CLR: Overview

Introduction

The CLR stands for  Common Language Runtime  is an Execution Environment . It works as a layer between Operating Systems and the applications written in .Net languages that conforms to the Common Language Specification (CLS). The main function of Common Language Runtime (CLR) is to convert the Managed Code into native code and then execute the Program. The Managed Code compiled only when it needed, that is it converts the appropriate instructions when each function is called . The Common Language Runtime (CLR) 's just in time (JIT) compilation converts Intermediate Language (MSIL) to native code on demand at application run time.

 

When .Net application is executed at that time control will go to Operating System,then Operating System Create a process to load CLR.

The program used by the operating system for loading CLR is called runtime host,which are diffrent depending upon the type of application that is desktop or web based application i.e.

The runtime host for desktop applicaitons is API function called CorbinToRuntime.

The runtime host for web based applications is asp.net worker process(aspnet-wp.exe).

CLR runtime engine comes with set of services,which are classified are as follows

CLR services

  • Assembly Resolver
  • Assembly Loader
  • Type Checker
  • COM marshaller
  • Debug Manager
  • Thread Support
  • IL to Native compiler
  • Exception Manager
  • Garbage Collector 

let us know about these services in brief.

Assembly Resolver

Assembly reslover will read manifest of application, it will identify private and shared assembly required for application execution , the request will be send to assembly loader.

Assembly Loader

Assembly loader will load assembly into applicaiton process based on assembly resolver intstructions.

Type Checker

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

COM marshaller

COM marshaller will provide communication with COM component, this supports COM interoperability.

Debug Manager

Debug Manager service will activate debugger utility to support line by line execution , the developer can make changes as per requirement without terminating application execution.

Thread Support

Thread support will manage more than one execution path in applicaiton process. This provides multithreading support.

IL to Native compiler

 

IL to native compiler is called JIT compiler(just-in-time compiler) , this will convert IL code into operating System native code.

Exception Manager

Exception Manager will handle exceptions thrown by application by executing catch block provided by exception, it there is no catch block , it will terminate application.

Garbage Collector

 

Garbage Collector will release memory of unused objects, this provides automatic memory management.

this is the brief introduction about the CLR,In future i will write the detail blog about each services.I hope its helpful for all readers.