Common Language Runtime
The Common Language Runtime (CLR) is an Execution Environment. It works as a layer between Operating Systems and the applications written in .Net language. 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 CLR’s Just in Time compilation converts Intermediate Language (MSIL) to native code on demand at application run time.
During the execution of the program, the Common Language Runtime manages memory, Thread execution, Garbage Collection, Exception Handling, Common Type System (CTS), code safety verifications, and other system services. The Common Language Runtime defines the Common Type System (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, so Common Language Runtime is a language-independent runtime environment. The Common Language Runtime environment is also referred to as a managed environment, because during the execution of a program it also controls the interaction with the Operating System.
Common Language Runtime's main tasks are to convert the .NET Managed Code to native code, manage running code like a Virtual Machine and also control the interaction with the Operating System. Common Language Runtime manages Thread executions, Memory Management that is allocation of Objects and Buffers , Garbage Collection - Clean up the unused Objects and buffers , Exception Handling, Common Type System that is all .NET language that conforms to the Common Language Specification have the same primitive Data Types, Code safety verifications - code can be verified to ensure type safety.