Você está na página 1de 58

.

NET

. . - ,
. -.

(C, C++, Pascal, Fortran, )


(Basic, Javascript, VBA, )
2 intermediate code +
JIT (just-in-time)
intermediate code (JAVA, CLR)

compiler-compiler ( ,
)
yacc,

bison,

( ) (JAG, Clarion)

Compiler vs. Interpreter

Hybrid compiler-interpreter




(plumbing) :
,
, , ...


Intermediate code / Virtual machine approach


Virtual machine = completely isolated guest
operating system installation within a normal
host operating system

System (hardware) virtual machine (VMware, VirtualBox, )


Process (application) virtual machine (JVM, CLI, Tamarin
(JavaScript), DOSBox, )
Operating system level virtualization (Microsoft Hyper-V, LinuxVserver, )

Managed / Unmanaged Code

Unmanaged code
Intel /
Windows

binary
file
intel

source
code

OS X
PowerPC

binary
file
PowerPC

binary
file
Intel / Linux

intel

Compile

Managed code
Intel /
Windows

VM

platform
independent

source
code

intermediate
code

OS X
PowerPC

VM

VM
Intel / Linux

Compile

Managed / Unmanaged code


source
code

compiler

binary
executable

Execute

Unmanaged code

source
code

compiler

Execute

binary
executable

intermediate
code

interpreter or
JIT compiler

Managed code

10

Unmanaged Code





,
(type checking), , .

11

Managed Code




sandboxed environment.

Garbage Collection, type checking, exception
handling, bounds checking .
intermediate code
().

12

.NET


Windows Windows API
XML
web

/
web
SOAP, WSDL, UDDI

13

...


14

, CLR
(Common Language Runtime)
Intermediate Language (IL)

Managed code
Common Runtime Environment
Request for existing
features, such as opening a
file, mediated by CLR

Source code can be


in any language:
VB, VC++, COBOL

New CLR-only
features, such as
garbage collection

Intermediate
Language (IL)

Win32 OS

15

16

.NET

XML,

, ...

,
,

17

.NET?

.NET
.

,
,
Microsoft

Microsoft .NET platform .NET


18

.NET Framework Evolution

Application

Code and data


structures

.NET Framework Evolution

COM
.
,


.

.NET Framework Evolution

.NET Framework CLR,


.


.

.NET

.NET

Common Language Runtime (CLR)
CLR

().

1.
2.

Microsoft
Intermediate Language (IL).
IL
CLR

22

CLR

IL Java byte code



(
)


:
,


23

IL




24

.NET

Microsoft NGWS

2000
:

1.0 (2002),
1.1 (2003),
2.0 (2005),
3.0 (2006),
3.5 (2007),
4.0 (2010)
4.5 (2012)

4.5.1 (2013)

25

.NET

.NET - European Computer


Manufacturers Association (ECMA) Open Standards
Institute (OSI) Common Language Infrastructure
(CLI)
IL Common Intermediate
Language (CIL) MSIL
.NET CIL

SSCIL (Microsoft) open source (2006)


Mono (Novell / Xamarin) open source
Portable.NET (part of DotGNU)
CrossNet (free) MIT licence

26

.NET

Common Language Runtime (CLR)


Type System (CTS)

Common

(.NET
Framework)

(ASP.NET)

27

Common Language Runtime

.NET

() - integer, float, user


defined, ...
,


garbage collection,
-

Native API, COM interop, ...

JVM

28

CLR compilation and execution


Compilation
assembly

source
code

compiler

code
metadata

Execution
Execute

Before installation or the first


time each method is called
binary
executable

JIT compiler

29

Assembly

.NET
Assembly = IL code + Metadata
Metadata
Assembly

:
-
-

-

- ...

Assembly
Manifest

Metadata

IL code

Resources

The role of an assembly is to be a unit of deployment, execution, identity,


and security in the managed environment

30

CLR Execution Process

Start
Windows
Examines
Executable File
Header

Windows
or CLR?

Windows

Execute

End

JIT Compile
Method

No

CLR

Run CLR

No
Method
Already
JITted?

Load Assembly

Yes

Yes
No

Execute
Method

More code
to execute?

Yes

Assembly
in
Memory?

31

CLR

JIT


working set
AOT (ahead-of-time) compilation
Native Image Generator (Ngen.exe)

-
( )

32

CLR Features
Feature

Description

.NET Framework Class


Library support

Contains built-in types and libraries to manage assemblies,


memory, security, threading, and other runtime system support

Debugging

Facilities for making it easier to debug code

Exception management

Allows you to write code to create and handle exceptions

Execution management

Manages the execution of code

Garbage collection

Automatic memory management and garbage collection

Interop

Backward-compatibility with COM and Win32 code

Just-In-Time (JIT) compilation

An efficiency feature for ensuring that the CLR only compiles


code just before it executes

Security

Traditional role-based security support, in addition to Code


Access Security (CAS)

Thread management

Allows you to run multiple threads of execution

Type loading

Finds and loads assemblies and types

Type safety

Ensures references match compatible types, which is very useful


for reliable and secure code

33

.NET Framework Class Library (FCL)

( )


Windows

Forms
Windows Presentation Foundation
ASP.NET
ADO.NET
Windows Workflow, and
Windows Communication Foundation

34

.NET Framework Class Library (FCL)


:
file

I/O
Networking
text management, and
diagnostics

CLR :
built-in

types
exception handling
security, and
threading

35

Common Language Runtime Architecture

Base Class Library Support


Thread Support

COM Marshaler

Type Checker

Exception Manager

Security Engine

Debug Engine

IL to Native
Compilers

Code
Manager
Class Loader

Garbage
Collector

CLR
Platform independence
Performance improvement
Language interoperability
Support for object orientation and
interfaces
Distinct Value and reference Types
Strong data Typing

37


(type) =
( )




38

Common Type System (CTS)


CLR
( )

.
..
Common Type System (CTS).

FCL. int C#
Integer VB.NET
.NET System.Int32.

39

Common Type System (CTS)

CLR CTS IL FCL




. (

)

IL -
- Common Language Specification (CLS)
.NET
CLS-compliant non-CLS-compliant code (C# signed /
unsigned types)

40

CTS

41

CLR

Security
Role-based

security
Code-based security

Private/shared assemblies
Parallel Programming

42

CLR ,
-

20

Simplified Deployment ( )
-
assembly (no
registration required)

Zero-impact install

.NET COM

43

Languages Targeting the .NET CLR


A# (Ada)

Fortran

Phalanger (PHP)

APL

IronPython

Python

C++

IronRuby

RPG

C#

J#

Silverfrost FTN95

COBOL

Jscript

Scheme

Component Pascal

LSharp (Lisp)

SmallScript (S#)

Delphi

Mercury

Smalltalk

Delta Forth

Mondrian

TMT Pascal

Eiffel.NET

Oberon

VB.NET

F#

Perl

Zonnon

full list: http://dotnetpowered.com/languages.aspx


44

.NET Framework Architecture


VB

C++

C#

JScript

Common Language Specification


Windows Forms

ADO.NET and XML


Base Class Library
Common Language Runtime
Windows

COM+ Services

Visual Studio.NET

ASP.NET

ASP.NET

.NET

Active Server Pages (ASP)


Microsoft

46

Windows Forms (WinForms)


API
Microsoft .NET Framework

Microsoft
Windows
Windows API .
GUI .NET

47

ADO.NET

ADO.NET (ActiveX Data Objects for .NET)




( )


,

ADO.NET Entity Framework open source


object-relational mapping (OR) framework for
the NET Framework.

48

The .NET Framework stack

49

50

Windows Presentation Foundation

WinForms .NET
3.0
GUI XAML

Windows Forms, Windows Presentation
Foundation (WPF)
,
Windows desktop
Josh Smith (2007-09-05). "WPF vs. Windows Forms".
http://joshsmithonwpf.wordpress.com/: Josh Smith on WPF. Retrieved 2011-08-25.
"WPF is not intended to replace Windows Forms. [...] WinForms is still alive and well,
and will continue to be enhanced and supported by Microsoft for years to come.

51

.NET API
Windows Communication Foundation
(WCF)
Windows Workflow Foundation (WF)

.NET
Language Integrated Query (LINQ)

()

52

.NET
Microsoft's .NET Micro Framework
.NET
embedded

Microsoft .NET Compact Framework


(.NET CF) -
(PDA,
mobile phones, factory controllers, set-top
boxes)

53

.NET
.NET on Linux
MONO runtime engine for Linux


Linux
.NET

iOS
Andrioid

54

http://www.mono-project.com/Main_Page

Mono is a software platform designed to allow developers to easily create cross platform applications. Sponsored by
Xamarin, Mono is an open source implementation of Microsoft's .NET Framework based on the ECMA standards for C#
and the Common Language Runtime. A growing family of solutions and an active and enthusiastic contributing community
is helping position Mono to become the leading choice for development of Linux applications.

55

.NET


(native)
-

(SIMD,
CUDA)

,
Windows.


56

http://en.wikipedia.org/wiki/.NET_Framework
http://www.midnightbeach.com/dotNetArchitecture.2002.html
http://midnightprogrammer.net/file.axd?file=2009%2F9%2FMicrosoft
+.NET+Framework+4.0+Architecture.pdf
http://www.codeguru.com/csharp/sample_chapter/article.php/c8245
http://msdn.microsoft.com/enus/library/ff361664%28v=vs.110%29.aspx
http://www.codeproject.com/Articles/1825/The-Common-LanguageRuntime-CLR-and-Java-Runtime-E

57

58

Você também pode gostar