In this lession we learn how to execute code in different programming languages like c,java,and dotnet.
In Normal Programming languages like C|C++|Cobol|etc.
- In these programming languages, language compile will convert the source code and generates the native code.
- In general at the time of compilation language compiler will consider two factors.
- CPU/ Processor Architecture.
- Operating system Architucture
- Native code will be generated in such a way that it should be understood by the current processor and the operating system in which the code is being compiled and run.
|code execution in c|
What is Platform ?Platform is the combination of CPU Architecture and Operating System Architecture.
What is platform Dependency?
- Code that has been generated by the language compiler compilation does't run/ execute on a different processor and in different Operating System than which it has been compiled , this nature is known as platform dependency.
Platform In dependency
- If the code generated by language compiler(LC) compilation runs on any processor and in any operating System than which it has been compiled then it is known as platform independent.
Code Execution in Java
- In Java source code is compiled by java language compiler(JLC) and an intermediately code is generated known as byte code.
- This byte code is platform independent, which can be executed on any machine and in any operating system where JVM( Java Virtual Machine) is available.
- JVM Converts the byte code in to native code
- JVM is not a hard ware component rather it is a software component tool.
- Sun Company designed separate JVM for each Operating System, so that Byte Code is able to run in any Operating System.
- If there is no JVM compatible for any Operating System Byte Code can not be run in that operating System.
|code execution in java|
Code Execution in .Net
- in .Net code is compiled twice.
- in first compilation source code is compiled by respective language compiler and an intermediately code is generated known as MSIL.
- In second Compilation MSIL is Converted in to Native Code using CLR
- In Dot net we have two compilations.
- Always First compilation is slow and second compilation is fast.
- First Compilation : Means Language Compiler compiles the source code and provide the MSIL(Microsoft Intermediate Language) code.
- Second Compilation : CLR Converts the MSIL code to Native code means executable code then code will be executed by CLR.
- Here .NET source code means code that has been written in any programming language supported by .NET
- Every programming language has its own compiler.
|code execution in dotnet|
Note: LC: Language Compiler MSIL:Microsoft intermediate Language CIL: Common Intermediate Language CLR: Common Language Runtime
Check How much understand Our notes Interview Question on Dot Net