Net framework l.jpg
This presentation is the property of its rightful owner.
Sponsored Links
1 / 49

.Net Framework PowerPoint PPT Presentation

  • Uploaded on
  • Presentation posted in: General

.Net Framework. An Overview By: Sukhdeep Sidhu [email protected] Outline. .Net goals .Net concepts Design and compile time Deployment time Execution time Garbage Collection in .Net Summary. Online . Shop Get traffic conditions Compare products Read product reviews. More ?.

Download Presentation

.Net Framework

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Net framework l.jpg

.Net Framework

An Overview


Sukhdeep Sidhu

[email protected]

Outline l.jpg


  • .Net goals

  • .Net concepts

  • Design and compile time

  • Deployment time

  • Execution time

  • Garbage Collection in .Net

  • Summary

Online l.jpg


  • Shop

  • Get traffic conditions

  • Compare products

  • Read product reviews

Slide4 l.jpg

More ?

  • Search for restaurants in an area which offer a particular cuisine and have seating available at 7 pm tonight

  • Look for vendors having a particular item in stock, offering the best price and having the best delivery time

  • Why is this not possible ?

How to integrate services l.jpg

How to integrate services

  • XML standard for describing data

  • .Net: A new development platform infrastructure that will help developers create and deploy distributed applications on the Internet

Net goals 1 l.jpg

.Net Goals 1

  • Consistent programming model

  • Simplified programming model

  • Run once, run always

  • Execute on many platforms

  • Language integration

  • Code reuse

  • Automatic resource management

Net goals 2 l.jpg

.Net Goals 2

  • Type safety

  • Rich debugging support

  • Consistent error-handling

  • Deployment

  • Security

Outline8 l.jpg


  • .Net goals

  • .Net concepts

  • Design and compile time

  • Deployment time

  • Execution time

  • Garbage Collection in .Net

  • Summary

What is metadata l.jpg

What is Metadata ?

  • It is the common format for exposing the information describing a type

An example l.jpg

An example

  • What would the metadata of a C++ class describe ?

    • Methods of the class and their parameters

    • Data members of the class

    • Visibility of all class members

    • The concepts could extend to events the class could fire.

  • Comparable to .class in java ?

What s in the metadata l.jpg

What’s in the Metadata ?

  • Description of deployment unit (assembly)

    • Identity: name, version, culture[, public key]

    • What types are exported

    • Description of types

    • What other assemblies it depends on

    • Security permissions for it to run

What s in the metadata12 l.jpg

What’s in the Metadata ?

  • Description of types

    • Name, visibility, base class, interfaces

    • Members (methods, fields, properties, events, nested types)

  • Custom attributes

Assemblies l.jpg


  • Assembly is the unit of reuse and deployment in .Net

  • Assemblies can be single-file multi-file.

  • Consumer – assembly is a named and versioned collection of exported types and resources.

  • Developer – assembly is a collection of one or more files (HTML pages, metadata files, GIFS etc)

Manifest l.jpg


  • Components of an assembly are described in a manifest. Makes the assemblies self-describing

  • Set of tables that describe the assembly’s identity, culture, files and publicly exported types. Other referenced assemblies are also included

Outline15 l.jpg


  • .Net goals

  • .Net concepts

  • Design and compile time

  • Deployment time

  • Execution time

  • Garbage Collection in .Net

  • Summary

The right language for the job l.jpg

The right language for the job

  • MS plans to create four language compilers that target common language runtime – C++ with managed extensions, C#, Visual Basic, JScript.

  • Non-MS compilers for Cobol, Perl, Pascal, APL, Smalltalk, Scheme.

  • Rational planning to create Java compiler

The common type system l.jpg

The Common Type System

  • Formal specification of type system implemented by CLR

  • Possible member of a class – field, method, property and event

  • Visibility rules

  • Rules governing type inheritance, virtual functions, object lifetime

  • All class types must inherit from System.Object

Buiding types into a module l.jpg

Buiding types into a module

  • App.cs in C#

    public class App{

    static public void Main( System.String[] args){




  • Compiler generates a PE file (App.exe) containing the CLR header, the metadata and the MSIL

Building types into an assembly l.jpg

Building types into an Assembly

  • One of the PE files is selected as the keeper of a manifest or a separate file can contain the manifest.

  • Example: Add module to an assembly

    • Two source code files – RUT.cs (rarely used types) and FUT.cs (frequently used types)

    • Compile RUT.cs into one module (RUT.mod)

    • Compile FUT.cs into MyTypes.dll (this will be the keeper of manifest

  • Assembly Linker Utility

Rut module and mytypes dll l.jpg

RUT module and MyTypes.dll



RUT.cs methods’ compiled MSIL

FUT.cs methods’ compiled MSIL


RUT.cs defined types, methods…

RUT.cs referenced types, methods…


FUT.cs defined types, methods…

FUT.cs referenced types, methods…


Assembly files (self and RUT.mod)

Exported files (self and RUT.mod)

Outline21 l.jpg


  • .Net goals

  • .Net concepts

  • Design and compile time

  • Deployment time

  • Execution time

  • Garbage Collection in .Net

  • Summary

Assemblies22 l.jpg


  • Assemblies are key to application deployment

  • Private assemblies – deployed with the application for the sole use of the application. Runtime imposes no administrative policies

  • Shared assemblies – public-key cryptographic techniques

    • Guarantee name uniqueness

    • Secure notion of identity

Deployment l.jpg


  • Avoiding the DLL Hell !

    • Every assembly self describing through metadata

    • Every reference to a type is scoped by assembly reference

    • Well-defined heuristics to locate assemblies

  • Shared assemblies – Global Assembly Cache

Outline24 l.jpg


  • .Net goals

  • .Net concepts

  • Design and compile time

  • Deployment time

  • Execution time

  • Garbage Collection in .Net

  • Summary

Common language runtime l.jpg

Common Language Runtime

  • MSIL instructions cannot be directly executed

  • MSIL instructions are first compiled into native CPU instructions – JIT compiler

How runtime locates assemblies l.jpg

How runtime locates assemblies

  • Step 1: Initiating the bind

  • Step 2: Version policy in the application configuration


    <BindingRedir Name="Calcr"


    Version="*" VersionNew="" UseLatestBuildRevision="yes"/>


How runtime locates assemblies27 l.jpg

How runtime locates assemblies

  • Step 3: Locating Assembly through Codebases or Probing

    • Codebases

    • Probing

      • AppBase (order: .mcl, .dll, .exe)

      • Search Path

    • Example

How runtime locates assemblies28 l.jpg

How runtime locates assemblies



SEARCH PATH=bin (The AssemblyResolver changes this to: MyName;bin)


Explicit Codebases:

Binding context CODEBASE=

App.cfg CODEBASE=[none]

Probing URLs:

















How runtime locates assemblies29 l.jpg

How runtime locates assemblies

  • Step 4: The Global Assembly Cache and Auto-QFE policy

  • Step 5: Administrator Policy

    • Version policies specified by the administrator

Jit compilers l.jpg

JIT compilers

  • Normal compiler

    • Examine’s a method’s MSIL

    • Optimizes the resulting native code just like the back end of an unmanaged compiler

  • Economy compiler

    • On machines where cost of using memory and CPU cycles is high

    • Replaces each MSIL instruction with its native code counterpart

Verification and security 1 l.jpg

Verification and Security 1

  • Code Identity – through class loader or interoperability services

  • Type safety – access only memory that has been allocated for their use and access objects only through their exposed interfaces

    • Combine strong typing in metadata with strong typing in MSIL

Verification and security 2 l.jpg

Verification and Security 2

  • Code Access Security

  • Resource Permissions – CLR walks up the call stack to check if all assemblies have required permissions

  • Identity permissions – Site, Zone, Shared Name, Publisher

  • Declarative security – load time or runtime

Outline34 l.jpg


  • .Net goals

  • .Net concepts

  • Design and compile time

  • Deployment time

  • Execution time

  • Garbage Collection in .Net

  • Summary

Resource allocation l.jpg

Resource allocation

  • All resource allocated from a managed heap

The garbage collection algo 1 l.jpg

The Garbage Collection Algo 1

  • Makes a graph of accessible objects

The garbage collection algo 2 l.jpg

The Garbage Collection Algo 2

  • Collect the unaccessible objects

Finalization l.jpg


  • Object can gracefully clean up itself

  • Downsides:

    • Objects take longer to allocate

    • Performance is affected

    • No guarantee of order or execution

    • resurrection

Finalization internals 1 l.jpg

Finalization Internals 1

  • Before garbage collection

Finalization internals 2 l.jpg

Finalization Internals 2

  • Heap after garbage collection

Finalization internals 3 l.jpg

Finalization Internals 3

  • Heap after Second gabage collection

Weak references l.jpg

Weak References

  • Weak references allow the garbage collector to collect the object

  • To access the object, the application must obtain a strong reference to the object

  • Long/Short weak references

Generational garbage collector 1 l.jpg

Generational garbage collector 1

  • Also called ephemeral garbage collector

  • Based on following assumptions:

    • Newer the object, shorter its lifetime

    • Older the object, longer its lifetime

    • Newer objects strongly related and are frequently accessed around the same time

    • Compacting a portion of the heap faster than compacting the whole heap

Generational garbage collector 2 l.jpg

Generational garbage collector 2

  • Initially all objects in generation 0

  • Any objects surviving a garbage collection are considered to be generation 1

  • New objects are always added to generation 0

  • Generation incremented when an object survives the garbage collection (currently generation 2 is the highest)

Generational garbage collector 3 l.jpg

Generational garbage collector 3

  • Performance optimizations

    • Collect only from generation 0

    • If more memory required, proceed to higher generations

Issues in garbage collection l.jpg

Issues in garbage collection

  • Multi-threaded applications

    • Fully interruptible code

    • Hijacking – modifying the thread’s stack so that the return address points to a special function

    • Safe points

    • Synchronization free allocations

    • Scalable collections

Outline47 l.jpg


  • .Net goals

  • .Net concepts

  • Design and compile time

  • Deployment time

  • Execution time

  • Garbage Collection in .Net

  • Summary

Summary l.jpg


  • Enables building and deploying of web services and applications in any programming language

  • Bind applications over the Internet that take advantage of existing infrastructure and applications

  • A new platform for building integrated service-oriented applications for Internet Businesses.

References l.jpg


  • Jeffrey Richter’s articles in MSDN magazine:






  • Login