Common Language Runtime
Common Language Runtime
As the word specify Common which means CLR provides a common runtime or execution
environment as there are more than 60 .NET programming languages.
Main componenets of CLR:
Common Language Specification (CLS)
Common Type System (CTS)
Garbage Collection (GC)
Just In – Time Compiler (JIT)
Common Language Specification (CLS):
It is responsible for converting the different .NET programming language syntactical rules and
regulations into CLR understandable format.
provide the execution support to other programming languages also in .NET framework.
the MSIL code which is managed by the CLR is known as the Managed Code.
There are 2 Types of CTS that every .NET programming language have :
a. Value Types: Value Types will directly store the value directly into the memory location.
These types work with stack mechanism only. CLR allots memory for these at Compile Time.
b. Reference Types: Reference Types will contain a memory address of value because the
reference types won’t store the variable value directly in memory. These types work with
Heap mechanism. CLR allots memory for these at Runtime.
Garbage Collector:
It is used to provide the Automatic Memory Management feature. Suppose if there is no garbage
collector then programmers have to write the memory management codes which will be a kind of
overhead on programmers.
JIT(Just In Time Compiler):
It is responsible for converting the CIL(Common Intermediate Language ) into machine code or
native code using the Common Language Runtime environment.
Performance improvements.
The ability to easily use components developed in other languages.
Extensible types provided by a class library.
Language features such as inheritance, interfaces, and overloading for object-oriented
programming.
Support for explicit free threading that allows creation of multithreaded, scalable applications.
Support for structured exception handling.
Support for custom attributes.
Garbage collection.
Use of delegates instead of function pointers for increased type safety and security.