CLR (Common Language Run time)
- It is runtime environment of .net.
- CLR contains a component called Just In-Time Compiler (JIT), which will convert the Intermediate language into native code which the underlying operating system can understand.
- So, in .NET the application execution consists of 2 compilation,
1. Language compiler, compiles the Source Code into Intermediate Language (IL)
2. JIT compiler in CLR converts, the IL into native code which can then be run on the underlying operating system.
- Always first compilation is slow and second compilation fast.
- The native code is not stored permanently anywhere, after we close the program the native code is thrown away. When we execute the program again, the native code gets generated again.
- .NET program is similar to java program execution. In java we have byte codes and JVM (Java Virtual Machine), where as in .NET we Intermediate Language and CLR (Common Language Runtime).
- Many people ask this question, java is platform independent,what about .net?
- The answer is “Yes” and “No” !
- The code you write is platform independent, because whatever you write is getting compiled into MSIL. There is no native code, which depends on your operating system or CPU. But when you execute the MSIL, the .NET framework in the target system will convert the MSIL into native platform code.
- MSIL is only CPU independent & will run only on windows OS only using .net framework, because, .net framework is designed for windows operating system only.
- There is another company known as Novell designed separate framework known by MONO framework using this framework we can run MSIL on different operating system like MacOS,Linux,BSD etc.
- .NET is a platform dependent using .NET framework but independent using mono framework.
- For Info on Mono framework please visit(http://www.mono-project.com)