NETs CLR How does it really work 1

  • Slides: 23
Download presentation
. NET’s CLR How does it really work? 1 Bhavani Sankar Ikkurthi CS 795

. NET’s CLR How does it really work? 1 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

Overview CLR : Common Language Runtime Platform for software development that provides services by

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 2 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

CLR BASICS Core of. NET vision 3 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

CLR BASICS Core of. NET vision 3 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

CLR as a development platform It provides 4 Bhavani Sankar Ikkurthi CS 795 Presentation

CLR as a development platform It provides 4 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

Runtime A piece of code written by platform vendor Provides services to the software

Runtime 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. 5 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

Runtime 6 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

Runtime 6 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

Libraries CLR's Base Class Library allow us to interact with the runtime, and provide

Libraries 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 7 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

Languages How do I take advantage of libraries and runtime C#, Visual Basic. NET,

Languages How do I take advantage of libraries and runtime C#, Visual Basic. NET, IL, C++, and JScript. NET How is CLR different then? ? 8 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

Components Component oriented programming from Hardware Software systems can be built from software components

Components 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 9 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

Standards A standard is a document that describes a convention or protocol that everyone

Standards 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 10 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

. NET is cross-platform Compiled. NET apps run on any supported platform: APP. exe

. NET is cross-platform Compiled. NET apps run on any supported platform: APP. exe ? Win 64 11 Win 32 (XP, 2 K, 98) Win. CE Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

How is cross-platform achieved? Cross-platform execution realized in two ways: Apps are written against

How is cross-platform achieved? 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 12 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

The Common Language Runtime (CLR) The CLR defines a common programming model and a

The Common Language Runtime (CLR) The CLR defines a common programming model and a standard type system for cross-platform, multi-language development. ” 13 All. NET-aware compilers generate Intermediate Language (IL) instructions and metadata. The runtime's Just-in-Time (JIT) compiler convert the IL to a machinespecific (native) code when an application actually runs. Because the CLR is responsible for managing this IL, the code is known as managed code. Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

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

Intermediate Language (IL) All. NET-aware compilers generate Intermediate Language (IL) instructions and metadata. 14 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

Assemblies 1 assembly = 1 or more compiled classes . EXE represents an assembly

Assemblies 1 assembly = 1 or more compiled classes . EXE represents an assembly with classes + Main program. DLL represents an assembly with classes code. vb code. cs Development Tools . EXE /. DLL assembly 15 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

. NET Application Design Monolithic app: all source code compiled into one. EXE not

. NET Application Design Monolithic app: all source code compiled into one. EXE not the norm on Windows… APP. exe • Component-based app: . EXE + one or more. DLLs – standard practice on Windows… compute. dll GUI. exe data. dll – 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! 16 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

CLR-based execution Common Language Runtime must be present to execute code: APP. exe OS

CLR-based execution Common Language Runtime must be present to execute code: APP. exe OS Process other FCL components JIT Compiler obj code Core FCL CLR Underlying OS and HW 17 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

CLR-based execution revisited CLR must be able to locate all assemblies: . DLL .

CLR-based execution revisited CLR must be able to locate all assemblies: . DLL . EXE OS Process other FCL assemblies JIT Compiler obj code Core FCL assembly CLR Underlying OS and HW 18 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

mscoree. dll - Common Object Runtime Execution Engine 19 Bhavani Sankar Ikkurthi CS 795

mscoree. dll - Common Object Runtime Execution Engine 19 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

Memory Management 20 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

Memory Management 20 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

Memory Management 21 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

Memory Management 21 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

References http: //www. theserverside. net/tt/articles/showarticle. ts s? id=DM_CLR http: //msdn. microsoft. com/enus/library/8 bs 2

References http: //www. theserverside. net/tt/articles/showarticle. ts s? id=DM_CLR http: //msdn. microsoft. com/enus/library/8 bs 2 ecf 4(VS. 71). aspx C# and the. NET Platform, Second Edition by Andrew Troelsen 22 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

23 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021

23 Bhavani Sankar Ikkurthi CS 795 Presentation 10/29/2021