Lecture 4: J# Execution Model. 2 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-2 Objectives “J# programs execute like any other.NET program.

Slides:



Advertisements
Similar presentations
Using.NET Platform Note: Most of the material of these slides have been taken & extended from Nakov’s excellent overview for.NET framework, MSDN and wikipedia.
Advertisements

Wrap-up: Where Do You Go From Here? MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET Objectives “.NET is the future of software development.
.NET Technology.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 1.1 of…
Programming Our First Java Program Yingcai Xiao. What to Do Set up for Java Programming Write our first Java Program with IDE Write our first Java Program.
Advanced Object-Oriented Programming Features
Data Structure and Algorithm 1 Yingcai Xiao. You Me The Course (
Programming A Historic Perspective on Code Reuse Yingcai Xiao.
Keith Elder Microsoft MVP It’s the new wave…man…..
Introducing the Common Language Runtime for.NET. The Common Language Runtime The Common Language Runtime (CLR) The Common Language Runtime (CLR) –Execution.
.NET’s CLR How does it really work? 7/2/20151Bhavani Sankar Ikkurthi CS 795 Presentation.
2. Developing in.NET and C#. 2 Microsoft Objectives “Microsoft.NET development is based on an underlying framework of tools and classes. These tools and.
Introduction to Java.
Lecture 5: Component-based Programming. 2 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 5-2 Objectives “Components are another term for classes,
Tahir Nawaz Visual Programming C# Week 2. What is C#? C# (pronounced "C sharp") is an object- oriented language that is used to build applications for.
Introduction to VB.Net ITE-370. What is.NET? A brand of Microsoft technologies A platform for creating distributed Web applications A combination of new.
Intro to dot Net Dr. John Abraham UTPA – Fall 09 CSCI 3327.
Lecture 2: An Introduction to J# and.NET. 2 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 2-2 Objectives “Microsoft.NET is based on the.NET.
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
A Free sample background from © 2001 By Default!Slide 1.NET Overview BY: Pinkesh Desai.
Overview of Microsoft.Net and Vb.Net ITSE 2349 Spring 2002 Material from Microsoft.Net an Overview for ACC faculty by Stuart Laughton and Introduction.
© 2004 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Programming the Web Using ASP.Net Chapter 2: The ASP.Net Template Dave.
Lecture Roger Sutton CO530 Automation Tools 5: Class Libraries and Assemblies 1.
Computer Science 317 Database Management Introduction to Web Access to Databases.
M1G Introduction to Programming 2 4. Enhancing a class:Room.
1..NET Architecture Based on slides by Joe Hummel.
Introduction to ASP.NET. Prehistory of ASP.NET Original Internet – text based WWW – static graphical content  HTML (client-side) Need for interactive.
1 Program Execution in the 21 st Century Modern Software Development in.NET and C# A webcast series for C++, Java, and VB6 developers – Part 1 of 15: [
Architecture of.NET Framework .NET Framework ٭ Microsoft.NET (pronounced “dot net”) is a software component that runs on the Windows operating.
C# A 1 CSC 298 Introduction to C#. C# A 2 What to expect in this class  Background: knowledge of an object oriented language of the C++, Java, … family.
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
.NET Framework & C#.
Microsoft.NET Vs Sun JAVA
Lecture Set 1 Part B: Understanding Visual Studio and.NET – Structure and Terminology 1/16/ :04 PM.
Understanding Code Compilation and Deployment Lesson 4.
Lesley Bross, August 29, 2010 ArcGIS 10 add-in glossary.
Importing outside DLLs into.Net platform and using them By Anupama Atmakur.
ASSEMBLY. A SSEMBLY Assemblies are the fundamental units of applications in the.net framework An assembly can contain classes, structures, interfaces.
All 300/400 Level CS Major Courses Tutoring Location: SEC 3433 Sign up or walk-in Introduction2-1.
Introduction .NET Framework
Lecture 1 Programming in C# Introducing C# Writing a C# Program.
 2005 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and the World Wide Web.
1..NET Architecture Based on slides by Joe Hummel.
.NET Framework Danish Sami UG Lead.NetFoundry
The Web Architecture and ASP.NET. Slide 2 Review of the Web (1) It began with HTTP and HTML, which delivers static Web pages to browsers which would render.
Week 1: THE C# LANGUAGE Chapter 1: Variables and Expressions ➤ Included in Visual Studio.NET ➤ What the.NET Framework is and what it contains ➤ How.NET.
Introduction to VB.Net. What is.NET? A brand of Microsoft technologies A platform for creating distributed Web applications A combination of new and updated.
Module 1: Getting Started. Introduction to.NET and the.NET Framework Exploring Visual Studio.NET Creating a Windows Application Project Overview Use Visual.
Compunet Corporation1 Programming with Visual Basic.NET Fundamentals of Programming Lecture # 1 Tariq Ibn Aziz.
Intro to dot Net Dr. John Abraham UTPA CSCI 3327.
PRIOR TO WEB SERVICES THE OTHER TECHNOLOGIES ARE:.
Introduction to VB.Net ITE-370. What is.NET? A brand of Microsoft technologies A platform for creating distributed Web applications A combination of new.
BIL527 – Bilgisayar Programlama I Introduction 1.
1. The .NET Architecture 1. The .NET Architecture 2003
Text Introduction to.NET Framework. CONFIDENTIAL Agenda .NET Training – Purpose  What is.NET?  Why.NET?  Advantages  Architecture  Components: CLR,
Lecture Set 1 Part B: Understanding Visual Studio and.NET – Structure and Terminology 1/16/ :04 PM.
OE-NIK HP Advanced Programming Using and creating DLL files.
ClickOnce Deployment (One-click Deployment)
Lecture 1: The .NET Architecture
Computer System Structures
What is .NET.
INF230 Basics in C# Programming
Introduction to Computers, the Internet and the World Wide Web
An Introduction to the Shared Source Common Language Infrastructure (SSCLI) Damien Watkins Copyright Watkins 2002.
“An Introduction to .NET, C# and Visual Studio 2005”
CE-105 Spring 2007 Engr. Faisal ur Rehman
2.1. Compilers and Interpreters
Advanced Programming: C# Lecture 01: Introduction
Review of Previous Lesson
ClickOnce Deployment (One-click Deployment)
Presentation transcript:

Lecture 4: J# Execution Model

2 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-2 Objectives “J# programs execute like any other.NET program --- based on a run-time execution engine and an extensive software library. The details of how this works is quite interesting, and exemplifies how program execution has evolved... ”.NET execution model J# execution model

3 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-3 Part 1.NET execution model…

4 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-4 Example Recall the Banking App we built… transactions.txt customers.txt Banking App

5 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-5 BankingApp.exe Visual Studio.NET produces.EXE: Visual Studio.NET App.jsl Customer.jsl CustomersIO.jsl Transactions.jsl BankingApp.exe

6 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-6 How does.EXE execute? Since you can double-click on.EXE, you might be mislead… Recall the.NET architecture: –run-time environment + large software library Hardware Operating System Common Language Runtime (CLR) BankingApp.exe.NET Framework Class Library (FxCL)

7 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-7.NET execution model When you run.EXE, a process is created & a small main() run –main() loads CLR into process & starts CLR running –CLR then loads our.NET code & begins execution… Hardware Operating System BankingApp.exe process CLR FxCL BankingApp code

8 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-8 Why do this? As noted in Lecture 1, two reasons: 1.safer execution 2.portable execution Safer? –because CLR can prevent BankingApp from doing things it doesn't have permission to do Portable? –because BankingApp code can run anywhere CLR exists

9 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-9 Are.NET programs really portable? Yes! Implementations exist on: –FreeBSD (i.e. the OS underneath Mac OS X) –Linux ( Mono project) –Unix ( dotGNU project) Unfortunately, support for J# is lagging, mostly C# and VB at the moment…

10 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-10 What do compiled.NET programs look like? Java programs are compiled into bytecodes for portability.NET programs are compiled into CIL for portability –CIL = Common Intermediate Language –a portable, generic assembly language…

11 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-11 How does CLR execute CIL? CIL cannot be directly executed on the hardware CIL is translated at run-time into hardware's object code –this is know as Just-In-Time ("JIT") compilation Hardware Hardware Operating System Operating System BankingApp.exe process CLR FxCL JIT Compiler object code BankingApp code

12 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-12 Part 2 J# execution model…

13 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-13 Where's the Java Class Library? J# enables the best of both worlds: –you can use Java to program the.NET platform (i.e. FxCL) –you can use Java to program the Java platform (i.e. JCL) So far, we've only shown the FxCL: –where is the Java Class Library? –how is it represented? –how is it found?

14 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-14 (1) Where is the JCL? The JCL is considered part of the.NET Framework Class Library –in other words, it has been rewritten by Microsoft for.NET –compatible with Sun's JCL, but not a complete implementation: most of v1.1, some of v1.2 full support for portion of JCL required by AP CS BankingApp.exe process CLR BankingApp code FxCL JCL

15 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-15 (2) How is the JCL represented? Java uses.class &.jar files The.NET Framework Class Library is a set of.DLLs –DLL = Dynamic Link Library file –DLL = compiled code in library form, loaded & linked at run-time –1 DLL typically contains multiple classes –Windows OS itself is built from 100's of DLLs The JCL is a subset of the FxCL.DLLs: –vjscor.dll –vjslib.dll –VJSSupUILib.dll –… FxCL vjscor.dll vjslib.dll VJSSupUILib.dll......

16 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-16 (3) How is the JCL found? Java searches along a CLASSPATH (list) of directories J# searches exactly 2 places, in this order: 1.GAC : Global Assembly Cache (a Windows OS directory) 2.AppBase :directory containing.EXE file

17 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-17 The GAC The GAC is a global repository of.NET DLLs –.NET DLLs are known as "assemblies", hence the term assembly cache GAC is a protected Windows OS directory –created when.NET is installed –any user can read from cache –requires administrative rights to modify Location? –Windows XP :C:\Windows\Assembly –Windows 2000 :C:\WinNT\Assembly

18 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-18 Views of the GAC Explorer shows you conceptual view For actual representation, open command prompt & cd to it: C:\> cd Windows C:\Windows\> cd Assembly C:\Windows\Assembly> dir 04/20/2004 GAC 04/20/2004 NativeImages1_v /20/2004 NativeImages1_v /20/2004 temp C:\Windows\Assembly> cd GAC C:\Windows\Assembly\GAC> cd vjscor C:\Windows\Assembly\GAC\vjscor> cd 1.0.5* C:\Windows\Assembly\GAC\vjscor\1.0.5…> dir 04/20/20048,704vjscor.dll

19 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-19 One last piece of the puzzle... When you run.EXE file… … how does CLR know exactly which DLLs to load? BankingApp.exe process CLR BankingApp code FxCL vjscor.dll vjslib.dll VJSSupUILib.dll ?

20 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-20.DLL dependencies stored in.EXE.EXE contains a list of dependencies, as well as code…

21 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-21 How did dependencies end up in.EXE? Visual Studio.NET! Visual Studio compiles dependency information into.EXE –based on list of references maintained in project file… Every.DLL must be explicitly referenced –common references set for you automatically by VS.NET –additional references are added via Project menu, Add Reference…

22 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-22 ILDasm ILDasm = "IL Disassembler" ILDasm allows you to reverse engineer.EXE /.DLL –to see manifest, CIL, etc. ILDasm is a command-line tool –installed as part of Visual Studio.NET –to run, use Visual Studio.NET 2003 Command Prompt C:\BankingApp\bin\Debug> ildasm BankingApp.exe

23 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-23 Overlap between JCL and FxCL There is some overlap between Java Class Library and the.NET Framework Class Library, which can cause confusion. Consider the different implementations of ArrayList, each with its own method for finding the size: LibraryClass NameSize Method JCLjava.util.ArrayListsize() FxCLSystem.Collections.ArrayListget_Count()

24 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-24 ILDasm to see ArrayList size() For instance see the String methods using Intellisense. Both the JCL equals() and the FxCL Equals() are shown. Consider the implementation of ArrayList size() –Open a Visual Studio Command Prompt (Start / Visual Studio / Tools / Command Prompt) –Navigate to the GAC: C:/Windows / Assembly / GAC –Enter the vjslib directory, then into the version directory cd vjslib cd 1.0.5* –Look at the contents of vjslib.dll using ILDasm: ildasm vjslib.dll

25 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-25 ILDasm to see ArrayList size() (cont'd) Select java.util Drill down to locate java.util.ArrayList Note how the size() method is implemented

26 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-26 Summary J# is Java on the.NET platform –full support for.NET Framework Class Library –partial support for Java Class Library J# has a different execution model than Java –Java uses JVM, searches for.class/.jar files along CLASSPATH –J# uses CLR, searches for.DLL files in GAC & AppBase

27 MicrosoftIntroducing CS using.NETJ# in Visual Studio.NET 4-27 What's next? Lab #2…