Common Language Runtime
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 common language runtime (CLR) is the core
runtime engine for executing applications in the .NET Framework. The CLR allows
an instance of a class written in one language to call a method of the class
written in another language. At the base level, it is the infrastructure that
executes applications, and allows them to interact with the other parts of the
Framework. The code which runs under the CLR is called as Managed Code. Programmers need not to worry on managing the memory
if the programs are running under the CLR as it provides memory management and
thread management. The main function of Common Language Runtime (CLR) is to
convert the Managed Code into native code and then execute the Program. It acts
as a layer between Operating Systems and the applications written in .Net languages.
Compilers and tools expose the common language
runtime's functionality and enable you to write code that benefits from this
managed execution environment. Code that you develop with a language compiler
that targets the runtime is called managed code; it benefits from features such
as cross-language integration, cross-language exception handling, enhanced
security, versioning and deployment support, a simplified model for component
interaction, and debugging and profiling services.
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.
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.
Functions
of the CLR:
Class
Loader:
Used to load all classes at run time.
MSIL
to Native code compiler:
The Just In Time (JTI) compiler will convert MSIL
code into native code.
Code
Manager:
It manages the code at run time.
Garbage
Collector:
It manages the memory. Collect all unused objects
and deallocate them to reduce memory.
Thread
Support:
It supports multi-threading of our application.
Exception
Handler:
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.
- Prof. Shardul P. Patil
Thank you Sir
ReplyDelete