the common language runtime clr
play

The Common Language Runtime (CLR) Based on Mark Sapossnek - PowerPoint PPT Presentation

The Common Language Runtime (CLR) Based on Mark Sapossnek Computer Science Department Metropolitan College Boston University Agenda What Is the CLR? Assemblies Execution Model What is the CLR? The .NET Platform Clients


  1. The Common Language Runtime (CLR) Based on Mark Sapossnek Computer Science Department Metropolitan College Boston University

  2. Agenda � What Is the CLR? � Assemblies � Execution Model

  3. What is the CLR? The .NET Platform Clients Applications Web Form Web Service .NET Framework Protocols: HTTP, Tools: CLR HTML, XML, Visual Studio.NET, SOAP, UDDI Notepad Windows Your Internal .NET Foundation Third-Party .NET Enterprise Web Service Web Services Web Services Servers

  4. What Is the CLR? The .NET Framework � A set of technologies for developing and using components to create: Web Forms � Web Services � Windows applications � � Supports the software lifecycle Development � Debugging � Deployment � Maintenance �

  5. What Is the CLR? The .NET Framework VB C++ C# JScript … Visual Studio.NET Common Language Specification ASP.NET: Web Services Windows and Web Forms Forms ADO.NET: Data and XML Base Classes Common Language Runtime

  6. What Is the CLR? Overview � The CLR provides a run-time environment that manages the execution of code and provides services that improves development, deploy- ment, and run time. � Code that targets the CLR is called managed code.

  7. What Is the CLR? Goals � Development services � Deep cross-language interoperability � Increased productivity � Deployment services � Simple, reliable deployment � Fewer versioning problems – NO MORE ‘DLL HELL’ � Run-time services � Performance � Scalability � Availability

  8. What Is the CLR? Goal: Simpler Development � Plumbing disappears � Metadata � Transparent proxies � Memory management � Consistent exception handling � Great WYSIWYG tool support � Designers and wizards � Debuggers � Profilers � Increased productivity

  9. What Is the CLR? Goal: Simpler, Safer Deployment � No registration, zero-impact install � XCOPY deployment, incremental download � Side-by-side versions of shared components � Capture version at compile time � Administrative policy at run time DLL Hell � Evidence-based security policy � Based on code as well as user � Code origin (location) � Publisher (public key)

  10. What Is the CLR? Goal: Scalability � Smart device to Web Farm � Automatic memory management � Self-configuring � Dynamically tuning � Thread pool � Asynchronous messaging � Object remoting � Events � Smart device version � Multiple RTOSes � Same tools used for desktop

  11. What Is the CLR? Goal: Rich Web Clients, Safe Hosting � WinForms on the client � ASP.NET Web Forms on the server � Code is granted permissions � Evidence is used by policy to grant permissions � Application that starts runtime � Like Internet Explorer, IIS, SQL Server ™ , Shell � Provides some evidence � Controls code loading � Maps applications to processes

  12. What Is the CLR? Goal: Converge Programming Models � COM, ASP, VB, C++ All services available � Many services redesigned � Ease of use � Scalability � Consistent API � � Consistent framework raises the abstraction layer � Gradual transition from simplicity to full power � Less training, greater productivity

  13. What Is the CLR? Goal: Multiple Languages � Common Type System � Object-oriented in flavor � Procedural languages well supported � Functional languages possible � CLS guides frameworks design � Rules for wide reach � All .NET Framework functionality available � Over 15 languages investigated � Most are CLS consumers � Many are CLS extenders � Choose the right language for a particular job

  14. What Is the CLR? Highlights � Common Type System � Mapping of data types: Programming language � Framework � Just-in-time (JIT) compilers � JIT compiles intermediate language (MSIL) into native code � Highly optimized for platform or device � Garbage collector � Permission and policy-based security � Exceptions � Threading � Reflection � Diagnostics and profiling

  15. What Is the CLR? Services � Code management � Handling cross-language exceptions � Memory management and isolation � Interoperation between � Verification of type safety .NET Framework objects � Conversion of MSIL to and COM objects and native code Win32 DLLs � Loading and execution of � Automation of object managed code layout for late binding � Creation and � Developer services management of metadata (profiling, debugging, etc.) � Insertion and execution of security checks

  16. What Is the CLR? Architecture Base Class Library (.NET Framework) Support Thread Support COM Marshaler Type Checker Exception Manager Security Engine Debug Engine MSIL to Native Code Garbage Compilers (JIT) Manager Collector (GC) Class Loader

  17. What Is the CLR? Soon To Be a Standard � Microsoft, with HP and Intel, submitted proposal to ECMA to standardize: � C# � Common Language Infrastructure � Includes the Common Language Runtime and a subset of the .NET Framework classes � http://msdn.microsoft.com/net/ecma/ � http://www.ecma.ch

  18. Agenda � What Is the CLR? � Assemblies � Execution Model � Interoperability � Security

  19. Assemblies Overview � Contains code and metadata � Assemblies function as: � Unit of deployment � Type boundary � Security boundary � Reference scope boundary � Version boundary � Unit of side-by-side execution

  20. Assemblies Overview � Assemblies can be: � Static: DLL, EXE � Uses existing COFF binary format � Via existing extension mechanism � Dynamic � Create assemblies with � .NET Framework SDK � Visual Studio.NET � Your own code � Dynamic assemblies

  21. Assemblies Components of an Assembly � Manifest Metadata about the assembly itself � � Type metadata Completely describes all types defined in � an assembly � Managed code Microsoft Intermediate Language (MSIL) � Resources � For example, .bmp, .jpg �

  22. Assemblies Components of an Assembly ParcelTracker.DLL Manifest Type Metadata MSIL Resources

  23. Assemblies Components of an Assembly � An assembly is a logical unit, not physical � It can consist of multiple modules (.DLL, .JPG, etc.) Assembly Module In this figure, File containment implies a 1:M relationship Type

  24. Assemblies Components of an Assembly A single-file assembly A multi-file assembly Graphic.jpg Logo.gif File2.dll File1.dll Metadata Resource Resource Manifest MSIL Metadata MSIL File3.dll Manifest

  25. Assemblies Assembly Generation Tool: al.exe al.exe � Takes one or more files (containing either MSIL or resource files) and produces a file with an assembly manifest. � When compiling a C# file, you can specify that it create a module instead of an assembly by using /target:module .

  26. Assemblies Manifest � Manifest contains: � Identity information � Name, version number, culture, strong name � List of files in the assembly � Map of assembly types to files � Dependencies � Other assemblies used by this assembly � Exported types � Security permissions needed to run

  27. Assemblies Manifest and Metadata Type Descriptions Name Version Culture Manifest Other assemblies Security Permissions Exported Types Assembly Description Classes Base classes Metadata Implemented interfaces Data members Methods

  28. Assemblies What’s In the Metadata � Description of types � Name, visibility, base class, interfaces implemented � Members � methods, fields, properties, events, nested types � Attributes � User-defined � Compiler-defined � Framework-defined

  29. Assemblies Demo: ILDASM.EXE � Allows you to inspect the metadata and disassembled IL code in an assembly � Great way to see what’s really going on � Use ildasm /? to see the various options

  30. Assemblies Metadata � Key to simpler programming model � Generated automatically � Stored with code in executable file (.dll or .exe)

  31. Assemblies Metadata: Creation and Use Reflection Source Serialization Code (e.g. SOAP) Designers Compiler Other Compiler Debugger Assembly (Manifest, Type Browser Profiler metadata and code) Schema Proxy Generator Generator XML encoding (WSDL)

  32. Assemblies Compilers Use Metadata � For cross-language data type import � Emit metadata with output code � Describe types defined and used � Record external assemblies referenced � Record version information � Custom attributes can be used � Obsolete � CLS compliance � Compiled for debugging � Language-specific markers

  33. Assemblies Other Tools Use Metadata � Designer behavior � Controlled by user-supplied attributes � Category � Description � Designer extensibility � User-supplied attributes specify code to use � Type converters � Editors � Web methods marked by custom attribute � Type viewer

  34. Assemblies Global Assembly Cache � A set of assemblies that can be referenced by any application on a machine � Should be used only when needed � Private assemblies are preferred � Located at %SystemRoot%\assembly � ( c:\winnt\assembly ) � Add assemblies by � Installer program � gacutil.exe � Windows Explorer � Assembly Cache Viewer ( shfusion.dll ) is a shell extension for GAC that is installed with the .NET Framework SDK � .NET Framework Configuration Tool ( mscorcfg.msc ) � Assembly must have a strong name

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend