net’s clr

23
.NET’s CLR How does it really work? 06/12/22 1 Bhavani Sankar Ikkurthi CS 795 Presentation

Upload: zoey

Post on 30-Jan-2016

66 views

Category:

Documents


0 download

DESCRIPTION

.NET’s CLR. How does it really work?. Overview. CLR : Common Language Runtime Platform for software development that provides services by consuming metadata Standards based, Component oriented What is CLR Benefits Inside CLR. CLR BASICS. Core of .NET vision. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: NET’s CLR

.NET’s CLR

How does it really work?

04/22/231 Bhavani Sankar Ikkurthi CS 795 Presentation

Page 2: NET’s CLR

Overview

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

2

CLR : Common Language Runtime Platform for software development that

provides services by consuming metadata Standards based, Component oriented What is CLR Benefits Inside CLR

Page 3: NET’s CLR

CLR BASICS

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

3

Core of .NET vision

Page 4: NET’s CLR

CLR as a development platform

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

4

It provides

Page 5: NET’s CLR

Runtime

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

5

A piece of code written by platform vendor

Provides services to the software that you write

Visual Basic Runtime, the SQL Server Engine and the COM+/MTS runtime.

Page 6: NET’s CLR

Runtime

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

6

Page 7: NET’s CLR

Libraries

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

7

CLR's Base Class Library allow us to interact with the runtime, and provide additional useful functionality.

How do you take advantage of runtime?

BCL includes ASP.NET, XML Parser and other thousands of classes

Page 8: NET’s CLR

Languages

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

8

How do I take advantage of libraries and runtime

C#, Visual Basic.NET, IL, C++, and JScript.NET

How is CLR different then??

Page 9: NET’s CLR

Components

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

9

Component oriented programming from Hardware

Software systems can be built from software components

Organizing components can ease maintenance

Every piece of CLR functionality that we run must belong to a component

Page 10: NET’s CLR

Standards

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

10

A standard is a document that describes a convention or protocol that everyone agrees to follow

HTTP standard

Explicit support for XML and SOAP

CLI

Page 11: NET’s CLR

.NET is cross-platform

11

Compiled .NET apps run on any supported platform:

APP.exe

?Win64 Win32

(XP,2K,98)

WinCE

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

Page 12: NET’s CLR

How is cross-platform achieved?

12

Cross-platform execution realized in two ways: Apps are written against Framework Class Library (FCL),

not underlying OS Compilers generate generic assembly language which must be

executed by the Common Language Runtime (CLR)

• Framework Class Library– 1000's of predefined classes– common subset across all

platforms & languages – networking, database

access, XML processing, GUI, Web, etc.

– Goal? FCL is a portable operating system

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

Page 13: NET’s CLR

The Common Language Runtime (CLR)

13

The CLR defines a common programming model and a standard type system for cross-platform, multi-language development.” All .NET-aware compilers generate Intermediate Language (IL)

instructions and metadata. The runtime's Just-in-Time (JIT) compiler convert the IL to a machine-

specific (native) code when an application actually runs. Because the CLR is responsible for managing this IL, the code is

known as managed code.

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

Page 14: NET’s CLR

Intermediate Language (IL)

14

All .NET-aware compilers generate Intermediate Language (IL) instructions and metadata.

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

Page 15: NET’s CLR

Assemblies

15

1 assembly = 1 or more compiled classes .EXE represents an assembly with classes + Main program .DLL represents an assembly with classes

Development Tools

assembly

code.vbcode.vb

code.cs

.EXE / .DLL

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

Page 16: NET’s CLR

.NET Application Design

16

Monolithic app: all source code compiled into one .EXE not the norm on Windows…

APP.exe

compute.dll

data.dll

GUI.exe

• Component-based app: .EXE + one or more .DLLs – standard practice on Windows…

– team programming

– multi-language development (I like C#, you like C++, he/she likes VB)

– code reuse (e.g. across different .EXEs)

– independent updating (update just component X)

– FCL ships as a set of components! 04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

Page 17: NET’s CLR

CLR-based execution

17

Common Language Runtime must be present to execute code:

APP.exe

other FCL components

CLR

JIT Compiler

obj code

OS Process

Underlying OS and HW

Core FCL

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

Page 18: NET’s CLR

CLR-based execution revisited

18

CLR must be able to locate all assemblies:

.EXE

other FCL assemblies

CLR

JIT Compiler

obj code

OS Process

Underlying OS and HW

Core FCL

assembly

.DLL.DLL.DLL

obj codeobj code

obj code

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

Page 19: NET’s CLR

mscoree.dll - Common Object Runtime Execution Engine

19 04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

Page 20: NET’s CLR

Memory Management

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

20

Page 21: NET’s CLR

Memory Management

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

21

Page 22: NET’s CLR

References

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

22

http://www.theserverside.net/tt/articles/showarticle.tss?id=DM_CLR

http://msdn.microsoft.com/en-us/library/8bs2ecf4(VS.71).aspx

C# and the .NET Platform, Second Edition by Andrew Troelsen

Page 23: NET’s CLR

04/22/23Bhavani Sankar Ikkurthi CS 795 Presentation

23