My Profile

Tuesday, January 18, 2011

Platform Independency

Platform Independency :

In this approach, whenever the source code is compiled, it generates intermediate code (semi finished) intermediate code is not prepared targeting any Operating System. It is prepared targeting a special software which will take the responsibility of converting the intermediate code or semi finished code into machine code(Finished Code) fro execution.

Platform independency was provided  under Java and .Net languages also.

Platform Independency in Java 

Source Code ----> Compiled ----> Byte Code

Byte Code ----> JVM ----> Machine Code

In case of Java, the semi finished/intermediate code is known  as "byte code" and the software responsible in converting byte code to machine code is "JVM"(Java Virtual Machine).




fig: Platform Independency in Java

Note: JVM is dependent on the operating system, where we require a separate JVM for each operating system.


Platform Independency in .Net

Source Code ----> Compiled ----> CIL Code (MSIL)

CIL Code ----> CLR ----> Machine Code


The intermediate code which is generated after compilation of .net languages source code is known as CIL code (Common Intermediate Language) traditionally known as MSIL (Microsoft Intermediate language).

Here CLR (Common language Runtime) is the software which converts CIL code into machine code.



fig: Platform Independency in .Net Languages

Note : CLR is also dependent on the operating system just like JVM.

**Except CIL & Byte Code everything is OS dependent.


Compilation & Execution in .Net Languages



fig: Compilation & Execution of .Net Languages


.Net was a collection of languages giving a flexibility for the programmer to choose a language according thier choice.

So, a .Net application can be developed in any of the languages available. But to compile the code we require a compiler separate for each language and after compilation all compilers will generate the same IL code. that is why it was known as Common IL code.

This IL code is taken by the CLR to convert into machine code.

----------------------------------------------------------

** If you like this post please like our page in facebook

0 comments:

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More