.NET FRAMEWORK OVERVIEW
.NET FRAMEWORK :
The .NET Framework is a Software Framework Developed by Microsoft that runs primarily on Microsoft Windows. It includes a Large Library and Provides Language interoperability (Each Language Can Use Code Written In Other Languages) across Several Programming Languages.
Programs written for the .NET Framework execute in a software environment (As Contrasted To Hardware Environment), known as the Common Language Runtime (CLR), an application Virtual Machine(VL) that provides services such as Security, Memory Management, and Exception Handling. The Class Library(CL) and the CLR together constitute the .NET Framework.
The .NET Framework's Base Class Library(BCL) provides User Interface, Data Access, Database Connectivity, Cryptography, Web Application Development, Numeric Algorithms, and Network Communications. Programmers produce software by combining their own source code with the .NET Framework and other libraries.
The .NET Framework is intended to be used by Most New Applications created for the Windows platform. Microsoft also produces an Integrated Development Environment(IDE) largely for .NET software called Visual Studio.
HISTORY
Microsoft started development of the .NET Framework in the late 1990s, Originally under the name of Next Generation Windows Services (NGWS). By late 2000 the First Beta Versions of .NET 1.0 were Released.
OVERVIEW OF .NET FRAMEWORK RELEASE HISTORY
|
||||
GENERATION
|
VERSION NUMBER
|
RELEASE DATE
|
DEVELOPMENT TOOL
|
DISTRIBUTED WITH
|
1.0
|
1.0.3705.0
|
2002-02-13
|
Visual Studio .NET 2002
|
N/A
|
1.1
|
1.1.4322.573
|
2003-04-24
|
Visual Studio .NET 2003
|
Windows Server 2003
|
2.0
|
2.0.50727.42
|
2005-11-07
|
Visual Studio .NET 2005
|
Windows Server 2003 R2
|
3.0
|
3.0.4506.30
|
2006-11-06
|
Expression Blend
|
Windows Vista,
Windows Server 2008
|
3.5
|
3.5.21022.8
|
2007-11-19
|
Visual Studio .NET 2008
|
Windows 7,
Windows Server 2008 R2
|
4.0
|
4.0.30319.1
|
2010-04-12
|
Visual Studio .NET 2010
|
N/A
|
4.5
|
4.5.50709.17929
|
2012-08-15
|
Visual Studio .NET 2012
|
Windows 8,
Windows Server 2012
|
4.5.1
|
4.5.50938.18408
|
2013-10-17
|
Visual Studio .NET 2013
|
Windows 8.1,
Windows Server 2012 R2
|
The .NET Framework Family also includes Two Versions for Mobile or Embedded Device Use. A Reduced Version of the Framework, the .NET Compact Framework, is available on Windows CE Platforms, including Windows Mobile Devices such as Smartphones. Additionally, the .NET Micro Framework is targeted at Severely Resource-Constrained Devices.
DESIGN FEATURES
Interoperability
Because computer systems commonly require interaction between newer and older applications, the .NET Framework provides means to access functionality implemented in newer and older programs that execute outside the .NET environment. Access to COM components is provided in the System.Runtime.InteropServices and System.EnterpriseServices namespaces of the framework; access to other functionality is achieved using the P/Invoke feature.
Common Language Runtime (CLR)
The Common Language Runtime (CLR) serves as the execution engine of the .NET Framework. All .NET programs execute under the supervision of the CLR, guaranteeing certain properties and behaviors in the areas of memory management, security, and Exception Handling.
Language Independence
The .NET Framework introduces a Common Type System, or CTS. The CTS specification defines all possible datatypes and programming constructs supported by the CLR and how they may or may not interact with each other conforming to the Common Language Infrastructure (CLI) specification. Because of this feature, the .NET Framework supports the exchange of types and object instances between libraries and applications written using any conforming .NET language.
Base Class Library(BCL)
The Base Class Library (BCL), part of the Framework Class Library (FCL), is a Library of Functionality available to all languages using the .NET Framework. The BCL provides classes that Encapsulate a number of Common Functions, including file Reading and Writing, Graphic Rendering, Database Interaction, XML Document Manipulation, and so on. It consists of Classes, Interfaces of Reusable types that integrates with Clr(Common Language Runtime).
Simplified Deployment
The .NET Framework includes design features and tools which help manage the installation of computer software to ensure it does not interfere with previously installed software, and it conforms to Security Requirements.
Security
The Design Addresses some of the Vulnerabilities, such as buffer overflows, which have been exploited by Malicious Software. Additionally, .NET provides a Common Security Model for all applications.
Portability
While Microsoft has never implemented the full framework on any system except Microsoft Windows, it has engineered the framework to be platform-agnostic, and cross-platform implementations are available for Other Operating Systems. Microsoft submitted the specifications for the Common Language Infrastructure (which includes the core class libraries, Common Type System, and the Common Intermediate Language), the C# Language, and the C++/CLI language to both ECMA and the ISO, making them available as official standards. This makes it possible for third parties to create compatible implementations of the framework and its languages on other platforms.
ARCHITECTURE
Common Language Infrastructure (CLI)
The purpose of the Common Language Infrastructure (CLI) is to provide a Language-Neutral Platform for application Development and Execution, including functions for Exception Handling, Garbage Collection, Security, and Interoperability. By implementing the core aspects of the .NET Framework within the scope of the CLI, this functionality will not be tied to a Single Language but will be available across the many languages supported by the framework. Microsoft's implementation of the CLI is called the Common Language Runtime(CLR).
The CIL code is housed in CLI assemblies. As mandated by the specification, assemblies are stored in the Portable Executable (PE) format, common on the Windows platform for all DLL and EXE files. The assembly consists of one or more files, one of which must contain the manifest, which has the metadata for the assembly. The complete name of an assembly (not to be confused with the filename on disk) contains its simple text name, version number, culture, and public key token. Assemblies are considered equivalent if they share the same complete name, excluding the revision of the version number. A private key can also be used by the creator of the assembly for strong naming. The public key token identifies which public key an assembly is signed with. Only the creator of the keypair (typically the .NET developer signing the assembly) can sign assemblies that have the same strong name as a previous version assembly, since the creator is in possession of the private key. Strong naming is required to add assemblies to the Global Assembly Cache
SECURITY
.NET has its own security mechanism with two general features: Code Access Security (CAS), and validation and verification. Code Access Security is based on evidence that is associated with a specific assembly. Typically the evidence is the source of the assembly (whether it is installed on the local machine or has been downloaded from the intranet or Internet). Code Access Security uses evidence to determine the permissions granted to the code. Other code can demand that calling code is granted a specified permission. The demand causes the CLR to perform a call stack walk: every assembly of each method in the call stack is checked for the required permission; if any assembly is not granted the permission a security exception is thrown.
CLASS LIBRARY
The .NET Framework includes a set of standard class libraries. The class library is organized in a hierarchy of namespaces. Most of the built-in APIs are part of either System.* or Microsoft.* namespaces. These class libraries implement a large number of common functions, such as file reading and writing, graphic rendering, database interaction, and XML document manipulation, among others. The .NET class libraries are available to all CLI compliant languages.
The .NET Framework class library is Divided into Two Parts:
1. Base Class Library (BCL)
2. Framework Class Library (FCL)
The Base Class Library (BCL) includes a small subset of the entire class library and is the core set of classes that serve as the basic API of the Common Language Runtime. The classes in mscorlib.dll and some of the classes in System.dll and System.core.dll are considered to be a part of the BCL. The BCL classes are available in both .NET Framework as well as its alternative implementations including .NET Compact Framework, Microsoft Silverlight and Mono.
The Framework Class Library (FCL) is a superset of the BCL Classes and refers to the entire class library that ships with .NET Framework. It includes an expanded set of libraries, including Windows Forms, ADO.NET, ASP.NET, Language Integrated Query(LIQ), Windows Presentation Foundation(WPF), Windows Communication Foundation(WCF) among others. The FCL is much larger in scope than standard libraries for languages like C++, and comparable in scope to the standard libraries of Java.
MEMORY MANAGEMENT
The .NET Framework CLR frees the developer from the burden of Managing Memory (allocating and freeing up when done); it handles memory management itself by detecting when memory can be safely freed. Instantiations of .NET types (objects) are allocated from the managed heap; a pool of memory managed by the CLR. As long as there exists a reference to an object, which might be either a direct reference to an object or via a graph of objects, the object is considered to be in use. When there is no reference to an object, and it cannot be reached or used, it becomes garbage, eligible for collection. NET Framework includes a garbage collector which runs periodically, on a separate thread from the application's thread, that enumerates all the unusable objects and reclaims the memory allocated to them.
Garbage Collector (GC) :
The .NET Garbage Collector (GC) is a Non-Deterministic, Compacting, Mark-and-Sweep Garbage Collector. The GC runs only when a certain amount of memory has been used or there is enough pressure for memory on the system. Since it is not guaranteed when the conditions to reclaim memory are reached, the GC runs are non-deterministic.
Each .NET application has a set of roots, which are pointers to objects on the managed heap (managed objects). These include references to static objects and objects defined as local variables or method parameters currently in scope, as well as objects referred to by CPU registers. When the GC runs, it pauses the application, and for each object referred to in the root, it recursively enumerates all the objects reachable from the root objects and marks them as reachable.
It uses CLI metadata and reflection to discover the objects encapsulated by an object, and then recursively walk them. It then enumerates all the objects on the heap (which were initially allocated contiguously) using reflection. All objects not marked as reachable are garbage. This is the mark phase. Since the memory held by garbage is not of any consequence, it is considered free space.
However, this leaves chunks of free space between objects which were initially contiguous. The objects are then compacted together to make used memory contiguous again. Any reference to an object invalidated by moving the object is updated by the GC to reflect the new location. The application is resumed after the garbage collection is over.
The GC used by .NET Framework is also generational. Objects are assigned a generation; newly created objects belong to Generation 0. The objects that survive a Garbage Collection are tagged as Generation 1, and the Generation 1 objects that survive another collection are Generation 2 objects.
The .NET Framework uses up to Generation 2 objects. Higher generation objects are garbage collected less frequently than lower generation objects. This helps increase the efficiency of garbage collection, as older objects tend to have a longer lifetime than newer objects. Thus, by eliminating older (and thus more likely to survive a collection) objects from the scope of a collection run, fewer objects need to be checked and compacted.