Monday, March 5, 2012

.NET Development Foundation


What is Microsoft .NET FrameWork?

The Microsoft .NET Framework is a platform that provides tools and technologies for building network applications, as well as distributed web services and web applications.

The main two components of .NET Framework are :
1.CLR(Common Language Runtime)
2.FCL(.Net Framework Class Library)

CLR

The Common Language Runtime(CLR) is a an Execution Environment . Common Language Runtime (CLR)'s main tasks are to convert the .NET Managed Code to native code .

Common Language Runtime (CLR) manages Thread executions, Memory Management that is allocation of Objects and Buffers , Garbage Collection (GC) - Clean up the unused Objects and buffers , Exception Handling, Common Type System (CTS),Common Language Specification (CLS) etc.

[Managed Code:Managed Code in Microsoft .Net Framework is, the code that has executed by the Common Language Runtime(CLR) environment.
On the other hand Unmanaged Code is directly executed by the computer's CPU.
Examples for managed code are Garbage Collection, Type Safety etc.

The Managed Code running in a Common Language Runtime (CLR) cannot be accessed outside the runtime environment as well as cannot call directly from outside the runtime environment. This makes the programs more isolated and at the same time computers are more secure .

Unmanaged Code can bypass the .NET Framework and make direct calls to the Operating System. Calling unmanaged code presents a major security risk.]
FCL

.Net Frame work class library is a huge collection of language-independent and type-safe reusable classes.The .NET framework class libraries are arranged in to a logical grouping according to their functionality and usability is called Namespaces.
The base class library includes
  • types
  • collections
  • generics
  • text manipulation
  • basic drawing
  • basic globalization
  • serialization
  • basic input/output
  • multi-threading
  • etc.


How to Microsoft .Net Framework
Microsoft .NET languages source code are compiled in to Microsoft Intermediate Language(MSIL) .
Microsoft Intermediate Language (MSIL) is a CPU independent set of instructions that can be converted to the native code[01001110011011100110001111-machine language/binary code].

During the compile time Metadata is also created, with Microsoft Intermediate Language (MSIL), and stored it with the compiled code .Metadata is stored in a file called Manifest, and it contains information about the members, types, references and all the other data that the Common Language Runtime (CLR) needs for execution .

The Common Language Runtime (CLR) uses metadata to locate and load classes, generate native code, provide security, and execute Managed code. Both Microsoft Intermediate Language (MSIL) and Metadata assembled together is known as Portable Executable (PE) file.

During the runtime the Common Language Runtime (CLR)'s  Just In Time (JIT) compiler converts the Microsoft Intermediate Language (MSIL) code into native code to the Operating System. The native code is Operating System independent and this code is known as Managed Code , that is, the language's functionality is managed by the .NET Framework . The Common Language Runtime (CLR) provides various Just In Time (JIT) compilers, and each works on a different architecture depends on Operating Systems, that means the same Microsoft Intermediate Language (MSIL) can be executed on different Operating Systems. In the following section you can see how Common Language Runtime (CLR) functions .


Assemblies

"Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions".

Garbage Collection

The .Net Framework provides a new mechanism for releasing unreferenced objects from the memory (that is we no longer needed that objects in the program) ,this process is called Garbage Collection (GC).
When a program creates an Object, the Object takes up the memory. Later when the program has no more references to that Object, the Object's memory becomes unreachable, but it is not immediately freed.
The Garbage Collection checks to see if there are any Objects in the heap that are no longer being used by the application. If such Objects exist, then the memory used by these Objects can be reclaimed. So these unreferenced Objects should be removed from memory , then the other new Objects you create can find a place in the Heap.





No comments:

Post a Comment