net framework l.
Skip this Video
Loading SlideShow in 5 Seconds..
.Net Framework PowerPoint Presentation
Download Presentation
.Net Framework

Loading in 2 Seconds...

play fullscreen
1 / 49

.Net Framework - PowerPoint PPT Presentation

  • Uploaded on

.Net Framework. An Overview By: Sukhdeep Sidhu sidhu@cis. 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 ?.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about '.Net Framework' - morey

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
.Net Framework

An Overview


Sukhdeep Sidhu


  • .Net goals
  • .Net concepts
  • Design and compile time
  • Deployment time
  • Execution time
  • Garbage Collection in .Net
  • Summary
  • Shop
  • Get traffic conditions
  • Compare products
  • Read product reviews
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
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
.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
.Net Goals 2
  • Type safety
  • Rich debugging support
  • Consistent error-handling
  • Deployment
  • Security
  • .Net goals
  • .Net concepts
  • Design and compile time
  • Deployment time
  • Execution time
  • Garbage Collection in .Net
  • Summary
what is metadata
What is Metadata ?
  • It is the common format for exposing the information describing a type
an example
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
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
What’s in the Metadata ?
  • Description of types
    • Name, visibility, base class, interfaces
    • Members (methods, fields, properties, events, nested types)
  • Custom attributes
  • 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)
  • 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
  • .Net goals
  • .Net concepts
  • Design and compile time
  • Deployment time
  • Execution time
  • Garbage Collection in .Net
  • Summary
the right language for the job
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
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
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
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
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)

  • .Net goals
  • .Net concepts
  • Design and compile time
  • Deployment time
  • Execution time
  • Garbage Collection in .Net
  • Summary
  • 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
  • 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
  • .Net goals
  • .Net concepts
  • Design and compile time
  • Deployment time
  • Execution time
  • Garbage Collection in .Net
  • Summary
common language runtime
Common Language Runtime
  • MSIL instructions cannot be directly executed
  • MSIL instructions are first compiled into native CPU instructions – JIT compiler
how runtime locates assemblies
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
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
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
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
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
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
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
  • .Net goals
  • .Net concepts
  • Design and compile time
  • Deployment time
  • Execution time
  • Garbage Collection in .Net
  • Summary
resource allocation
Resource allocation
  • All resource allocated from a managed heap
the garbage collection algo 1
The Garbage Collection Algo 1
  • Makes a graph of accessible objects
the garbage collection algo 2
The Garbage Collection Algo 2
  • Collect the unaccessible objects
  • 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
Finalization Internals 1
  • Before garbage collection
finalization internals 2
Finalization Internals 2
  • Heap after garbage collection
finalization internals 3
Finalization Internals 3
  • Heap after Second gabage collection
weak references
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
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
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
Generational garbage collector 3
  • Performance optimizations
    • Collect only from generation 0
    • If more memory required, proceed to higher generations
issues in garbage collection
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
  • .Net goals
  • .Net concepts
  • Design and compile time
  • Deployment time
  • Execution time
  • Garbage Collection in .Net
  • Summary
  • 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.
  • Jeffrey Richter’s articles in MSDN magazine: