Common Language Runtime (CLR)

The Microsoft .NET Framework provides a runtime environment that is called the common language runtime (CLR). It is manages the execution of programs written in any supported languages such as C#, VB.Net, F#, J#, VC++ and many other .net compliant languages.

Common Language Runtime (CLR)

It  works  as  a  layer  between  operating  system  and  the  applications  written  in  .NET  languages that matches to the Common Language Specification (CLS).

The main function of CLR is to convert the managed code into native code and then execute the code.

The  CLR’s  Just  In  Time  (JIT)  compilation  converts  Intermediate  Language  (MSIL)  to  native  code  on demand at run time.
During  the  execution  of the program,  the  CLR manages  memory,  thread  execution, garbage- collection (GC), exception handling, CTS, code safety verifications, and other system services.

The CLR defines the CTS which is a standard type system used by all .NET languages.

That means all .NET programming languages uses the same representation for common data types, thus CLR is a language-independent runtime environment.

The  CLR  environment  is  also  referred  as  a  managed  environment,  because  during  the  execution  program it also controls the interaction with the Operating System.

(1) Thread Support

The .NET Framework provides a number of threading and synchronization facilities to allow you to build high performance, multithreaded code. Your choice of threading approach and synchronization mechanism impacts application concurrency; hence, it also impacts scalability and overall performance.

(2) COM Marshaler

COM marshaler allows .NET applications to exchange data with COM applications.

(3) Type Checker

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

(4) Exception Manager

The CLR supports structured exception handling to allow you to build robust, maintainable code. 
Use language constructs such as try/catch/finally to take advantage of structured exception handling.

(5) Security Engine

The  .NET  Framework  provides code access  security  to  ensure  that  code  has  the  necessary permissions to  perform  specific  types  of  operations  such  as  accessing  the  file  system,  calling  unmanaged  code, accessing network resources, and accessing the registry.

(6) Debug Engine

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.

(7) MSIL to Native Compilers (JIT)

The just-in-time (JIT) compiler converts the Microsoft intermediate language (MSIL) into native machine code at run time.
Methods that are never called, are not JIT-compiled.

(8) Garbage Collection

The garbage collector is responsible for allocating, freeing, and compacting memory.
Garbage  Collector  will  release  memory  of  unused  objects,  this  provides  automatic  memory management.

(9) Code Manager

Code manager invokes class loader for execution.

(10) Class Loader

The .NET Framework loader is responsible for locating and loading assemblies.

Previous
Next Post »

If you have any kind of question about any post, Feel free to ask.You can simply drop a comment below post. Your feedback and suggestions will be highly appreciated. ConversionConversion EmoticonEmoticon