The CLR (Common Language RunTime) :
- Is the foundation of the .NET Framework.
- Acts as an execution engine for the .NET Framework.
- Manages the execution of programs and provides a suitable environment for programs to run.
- Provides a multi-language execution environment.
The following figure shows a more detailed look at the working of the CLR:
Just in time (JIT) compiler converts MSIL to native code, which is CPU specific code.
When a code is executed for the first time;
⟶ The CIL ( COMMON INTERMEDIATE LANGUAGE ) code is converted to a code native to the operating system.
⟶ This is done at runtime by the Just-In-Time (JIT) compiler present in the CLR.
⟶ The CLR converts the CIL code to the machine language code.
⟶ Once this is done, the code can be directly executed by the CPU.