Q:Explain the fundamental architecture of .net frame work?
.Net frame work relies upon following 7 components.
CLR: Commonn Language Runtime, as the name suggests its a common runtime for all .net supported languages. The .net code does not directly talk to the OS. It is the CLR that seats above OS and make the communication between the .net code and OS happen. Any language targeting to CLR will enjoy all the features provided by it,e.g. Exception Handling,Security,Threading,Garbage Collection etc...
MSIL: The code that we write (in c#,vb or any other language) does not get directly compiled to the binary or machine code. The corresponding language compiler first converts it to an intermediate language called Microsoft Intermediate Language(MSIL) which is then converted to the machine code by the CLR. The MSIL produced from evru other language are same and hence this leads to interoperability among code written in various languages(c#,vb,j# etc...)
CLS: Common Language Specification(CLS) is a set of minimum guidelines that every language has to follow if they are targeting CLR.
JIT: Just In Time compiler is invoked by CLR while trying to compile the MSIL. Unlike any tradional compiler it doesnt compile the entire code at one go and rather compile only that portion of the code which is curently under execution. Once a code is compiled it is not compiled again and again unless some changes made to it. Hence next time when the same piece of code needs to be compiled again it'll get the same from memory and thus reducing the compilation time and increasing effiiency.
CTS: Common Type Specification is a common set of specification for various types (data type) that all .net languages have to comply with. Different languages have different ways to implement a data type, but they have tyo follow this CTS.
Microsoft Class Library: In order to make the developer's life easy microsft has a provided a huge class library(almost 13000 classes) with .net for common functionalities like I/O operation, Graphics feature, Threading etc...
Garbage Collection: Garbage Collection is an efficient way of memory management which does not rely on the user to explicitly free up un-used memory. When ever a certain memory remain un-used for a long period time .net calls the garbage collector and it will release that memory for further use.
Explain the Role of CLR in .net framework?
Ans: The Common Language Runtime(CLR) being a part of the .net framework provide an execution enviroment for the code written by .net targetted languages.
The corresponding language compiler compiles the code into intermediate language(MSIL) to a portable executable file (PE32 or PE64 type).
Than CLR takes care of converting this IL to CPU specific instruction by invoking the JIT.
The Language along with the enviroment writes some more information to the PE for the CLR to take care while executing the IL. These are information like required CLR version , langauge being used and its version etc...These information are stored in a metadata table
No comments:
Post a Comment