Advanced computer science teaching with the shared source common language infrastructure
This presentation is the property of its rightful owner.
Sponsored Links
1 / 35

Advanced Computer Science Teaching with the Shared Source Common Language Infrastructure PowerPoint PPT Presentation


  • 123 Views
  • Uploaded on
  • Presentation posted in: General

Advanced Computer Science Teaching with the Shared Source Common Language Infrastructure . Overview. In this session we will discuss What is the Shared Source Common Language Infrastructure (SSCLI)? Key SSCLI components Differences between SSCLI and .NET Working with the SSCLI

Download Presentation

Advanced Computer Science Teaching with the Shared Source Common Language Infrastructure

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Advanced computer science teaching with the shared source common language infrastructure

Advanced Computer ScienceTeaching with the Shared Source Common Language Infrastructure


Overview

Overview

  • In this session we will discuss

    • What is the Shared Source Common Language Infrastructure (SSCLI)?

    • Key SSCLI components

    • Differences between SSCLI and .NET

    • Working with the SSCLI

    • Using the SSCLI for teaching

    • Deploying the SSCLI in a teaching lab environment


What is the sscli

What is the SSCLI?


Ecma common language infrastructure cli

ECMA Common Language Infrastructure (CLI)

  • An international standard for a virtual execution environment

    • produced by Microsoft

  • Implementation of this standard is a subset of the .NET framework

    The specification (ECMA 335/ISO 23271/2 ) defines

  • common type system

  • intermediate language

  • component model

    A minimum implementation consists of

  • a C# compiler

  • CLI execution engine

  • component frameworks


Sscli a shared source cli

SSCLI – A Shared Source CLI

  • Microsoft’s free, modifiable and redistributable implementation of the CLI, codenamed Rotor

  • Platform independent

    • Currently executes on MS Windows, FreeBSD and Mac OS/X

    • Third party ports to Linux, Windows CE and others

  • Virtually identical to .NET 1.1 except for

    • retooled JIT compiler and garbage collector

    • C# generics support (Gyro)

  • Source written in C, C++, C#, Perl and assembly language

  • Other implementations of CLI are Ximian’s Mono and DotGNU’s Portable.NET


Implemented for learning

Implemented for Learning

  • Many areas of interest (3 million lines of code!)

  • Good, real-world example of how software is built

  • Contains useful component-based frameworks

    • Standard programming constructs

    • Web-service oriented networking and remoting

  • Contains compilers, tools, and utilities

    • C#, JScript, and IL JIT compilers

    • Assembler, disassembler, linker, debuggers

    • Configuration utilities

  • Extensive tests and build harness


Relationship of sscli and net framework

Relationship of SSCLI and .NET Framework

  • Both SSCLI and .NET implement complete ECMA

    • SSCLI is a superset of ECMA, subset of commercial .NET Frameworks

  • Shared source CLI implementation differs in

    • JIT and garbage collector replaced with more portable, more approachable, implementations

    • Only supports C# and JScript as development languages

    • Windows-specific features not included

      • COM interop

      • Windows Forms

      • “It Just Works!”(managed/unmanaged C++ integration)

    • Commercially competitive features not included

      • ADO.NET (database access)

      • enterprise services

      • NGEN (install-time, JIT-ahead precompilation)

      • ASP.NET (web application / web service development)


The net framework

VS.NET

System.Web (ASP.NET)

System.WinForms

SessionState

C#

UI

Design

ComponentModel

Caching

HtmlControls

JScript

Security

WebControls

System.Drawing

Configuration

VB

Simple Web Services

VC/MC++

Drawing2D

Printing

Protocols

Imaging

Text

Debugger

Discovery

Description

Designers

System.Data (ADO.NET)

System.Xml

ADO

SQL

XSLT

Serialization

SDK Tools

Design

Adapters

XPath

CorDBG

System

ILAsm

Collections

IO

Security

Runtime

InteropServices

Configuration

Net

ServiceProcess

ILDbDump

Remoting

Diagnostics

Reflection

Text

SN

Serialization

Globalization

Resources

Threading

ILDAsm

Common Language Runtime

MetaInfo

JIT

GC

App Domain Loader

PEVerify

MSIL

Common Type System

Class Loader

Windows Platform

Networking

IIS

COM+

MSMQ

Active Directory

Filesystem

The .NET Framework


Sscli

VS.NET

System.Web (ASP.NET)

System.WinForms

SessionState

UI

C#

Design

ComponentModel

Caching

HtmlControls

JScript

Security

WebControls

System.Drawing

Configuration

VB

Simple Web Services

VC/MC++

Drawing2D

Printing

Protocols

Imaging

Text

Debugger

Discovery

Description

Designers

System.Data (ADO.NET)

System.Xml

ADO

SQL

XSLT

Serialization

SDK Tools

Design

Adapters

XPath

CorDBG

System

ILAsm

Collections

IO

Security

Runtime

InteropServices

Configuration

Net

ServiceProcess

ILDbDump

Remoting

Diagnostics

Reflection

Text

SN

Serialization

Globalization

Resources

Threading

ILDAsm

Common Language Runtime

MetaInfo

JIT

GC

App Domain Loader

PEVerify

MSIL

CommonTypeSystem

ClassLoader

Platform Adaptation Layer

SSCLI


Platform adaptation layer

Platform Adaptation Layer

  • SSCLI is built on top of a Platform Adaptation Layer (PAL)

  • The PAL

    • isolates CLI implementation from the OS and hardware

    • runs co-operatively with native code

    • implements security and control, threading and exceptions

    • offers equivalent functionality to many Win32 OS functions

    • eases porting to new platforms - a student project?


Working with the sscli

Working with the SSCLI


Advanced computer science teaching with the shared source common language infrastructure

demo

  • Building the SSCLI

  • We’re setting this off now as it takes a while!


The sscli distribution

The SSCLI Distribution

  • SSCLI can be freely downloaded from the Web

  • Packaged as single compressed file archive

  • 1.9 million lines of code in first release (now ~3 million)

    • 1.15M of C and C++

    • 625K of C#

    • 125K of CIL (intermediate language)

    • Smattering of assembly code, Perl (test harnesses) and Tcl/Tk (UI)

  • 5900 source files (9700 total)

    • 2900 tests

  • Build output

    • 1200 defined types

    • About 20 dynamically loadable libraries

    • About 22 executable programs


The sscli source tree

The SSCLI Source Tree

  • Four major areas in source code

    • Runtime “execution engine”

    • Base class library

    • Compilers and tools

    • Portability layer, tests, and build infrastructure

  • Other important points of interest

    • License

    • Documentation

    • Samples


Sscli execution engine

SSCLI Execution Engine

  • Heart of component-oriented infrastructure

  • Converts metadata, resources, and CIL (on disk as PE/COFF image) into running code

  • JIT compilation and IL verification

  • Cross-language exception handling

  • Language-agnostic, object-capable, type system

  • Automatic heap and stack management

  • Dynamic code loading

  • Evidence-based security (code access security)


Common intermediate language

Common Intermediate Language

  • Basis for most managed code execution in the CLI

  • Simple stack-based machine model – see vm directory

  • Typeless opcodes, defined in opcode.def

    • Verifiable subset – see fjit directory for verification

    • Signed and unsigned via opcode, not type

  • CIL code is JIT compiled to run under CLI management

    • Type layout, control, and dispatching

      • Typed variable argument lists, dynamically typed pointers

      • Tail calls, virtual dispatch, call via function pointer

    • Rich set of conversion operations, calling conventions

    • Exception handling

    • Garbage collection


Frameworks

Frameworks

  • A “minimal toolkit” for the 21st century programmer

  • Base class library is a key feature of the ECMA CLI spec

    • Collections, arrays, strings, and other compound data types

    • Globalization and formatting

    • System services (threads, I/O, synchronization, etc.)

    • Security

  • SSCLI augments this with

    • Floating point and extended arrays libraries

    • Networking, regular expressions, and XML libraries

    • Access to runtime infrastructure

      • Reflection and custom attributes

      • Remoting, unmanaged interop, serialization, and marshaling

      • AppDomains, Assemblies, GC, other execution engine features


Compilers and tools

Compilers and Tools

  • Full-featured C# compiler

    • also used in build process

  • JScript compiler written entirely in C#

  • Additional developer tools

    • clix, the shared source CLI program launcher

    • Assembly tools: resource compiler, assembly linker, metainfo metadata viewer, assembler, disassembler

    • Debuggers: cordbg managed command line debugger, plus a debug extension for working on managed code from C/C++ via windbg


Advanced computer science teaching with the shared source common language infrastructure

demo

  • Developing software with the SSCLI

  • Debugging with cordbg


Sscli build process

SSCLI Build Process

  • Complex build which occurs in two phases and is driven by several build tools

    • nmake, build, Perl scripts

  • Initial phase builds

    • PAL using native toolchain

    • Build tools (nmake, build) against PAL for portability

    • resource compiler and PAL runtime using newly compiled build tools

  • Main phase has complex interdependencies

    • Unmanaged frameworks, compilers, and tools, are built

    • Managed portions of runtime and frameworks are built using compilers built previously

    • Assemblies and runtime are configured

  • Possible to rebuild individual SSCLI components

    • Allows teaching activities to focus on smaller parts of the SSCLI and rebuild those only

    • e.g. Hull JScript compiler modification exercises

  • Good example of how large software systems are built

    • Unfamiliar to most students


Sscli test suite

SSCLI Test Suite

  • Incredibly handy when modifying code!

  • Two major areas: managed code and PAL

  • PAL suites

    • Test driver script is pvtrun.pl

    • Used on new PAL implementations to verify compliance with PAL specification

  • Quality suites

    • Test driver script is rrun.pl

    • Tests for three primary aspects of SSCLI functionality

      • IL verification

      • “BVT” smoke tests – many small programs

      • Tests for the BCL


Using the sscli for teaching

Using the SSCLI for Teaching


Possibilities for teaching

Possibilities for Teaching

  • The SSCLI implementation touches upon many aspects of a standard Computer Science syllabus

    • Programming languages and skills

    • Object-oriented development

    • Framework design

    • Software testing

    • Security

    • Networking

    • Virtual machine implementation

    • etc, etc, etc

  • Many possible uses in the curriculum

    • Allows students to see the relevance of many of the aspects of the curriculum in the implementation of a large commercially-produced software product


The sscli at hull

The SSCLI at Hull

  • Hull University uses both the .NET Framework and the SSCLI for teaching at Master level

    • MSc in Distributed Systems Development

  • .NET provides

    • overreaching example of distributed systems concepts, techniques and technologies

  • SSCLI provides

    • “down to the metal” implementation details

    • excellent environment for enhancing testing/ debugging skills

  • We introduce three ways in which the SSCLI is used at Hull


Msc distributed systems development

MSc Distributed Systems Development

  • Our Masters course aims to

    • Give advanced coverage of modern distributed computing techniques

    • Develop an understanding of contemporary managed code environments and how they work

    • Develop skills in working with large codebases

    • Develop “active practitioners”

    • Provide hands-on practical experience underpinned by advanced theoretical concepts


Software maintenance exercise

Software Maintenance Exercise

  • Designed to improve students skills in

    • Navigating and comprehending unfamiliar code

    • Maintaining code written by others

    • Designing and implementing for maintenance

  • Requires students to make modifications to the JScript compiler

    • Modify the abstract syntax tree of the compiler

    • JScript compiler written in C# => easy introduction to SSCLI

    • JScript compiler can be built and deployed independently


Jit profiling exercise

JIT Profiling Exercise

  • Designed to provide

    • an introduction to key aspects of the virtual machine and JIT compiler implementation

    • An appreciation for how JIT compilation works to transform intermediate code to native code

    • A basis for further, more detailed study

  • Requires students to

    • Introduce new data structures

    • Modify JIT compiler to count CIL instructions

    • Sort and output profiling statistics on program completion

    • Code in an unmanaged language (unfamiliar to many)


Debugging exercise

Debugging Exercise

  • Optional exercise for students wanting to improve their debugging skills which is designed to

    • Get the students thinking about all aspects of the compilation and execution cycle

    • Provide opportunities to develop debugging and testing skills

    • Familiarise the student with the SSCLI code and the techniques used to implement it

    • Introduce problem solving and hypothesis testing skills relevant to debugging

    • Set the “worst case” scenario:

      • Deliberate bugs introduced in the underlying language and VM implementation; student’s code is fine, but it still doesn’t work!


Our experience

Our Experience

  • Feedback suggests that the students

    • Find the exercises initially challenging (particularly the JScript exercise)

    • Value what these exercises have taught them as they reach the latter stages of our Masters programme

    • Observe an improvement in their own coding, code comprehension and debugging skills as a direct consequence of being exposed to commercially produced code


Deploying the sscli

Deploying the SSCLI


Sscli in the teaching lab

SSCLI in the Teaching Lab

  • The SSCLI is really designed for a single developer working exclusively on a single machine - i.e. not the normal lab environment

    • Students use a different machine each session

    • Modifications made to the SSCLI by one student must not be visible to other students

    • Complete built installation requires ~1GB disk space

    • Building on a network drive => high network traffic

    • Managed code executed from a network drive is less trusted than code run from the local machine and may generate security exceptions


Our solutions

Our Solutions

  • Provide two local copies of the SSCLI distribution

    • Students have read/write permissions on one copy, read permissions on the other

    • Students use local modifiable copy for their work

    • Read-only copy manually copied over modifiable copy at start of each session and automatically each evening

  • Use source control system

    • Students use a source control system to store their changes to SSCLI components (not entire source tree)

    • Changes checked out over clean local copy at start of session

    • Changes checked back in at start of sessions

    • Promotes good development practice but significant overhead in administering source control system

  • Virtual PC (with Undo Disks) ?


Windows deployment issues

Windows Deployment Issues

  • SSCLI requires Visual C++ to build under Windows

    • Will not build against Visual C++ 8 / Visual Studio 2005

  • Vanilla distribution does not execute correctly on Windows XP Service Pack 2

    • Changes made to XP in SP2 break the exception handling mechanism

    • CD’s issued today have fixed copy of SSCLI source

  • Build harness attempts to create file association for Perl files

    • Our configuration does not permit students to create file associations

    • Easily fixed by removing a line from the build scripts


Advanced computer science teaching with the shared source common language infrastructure

Summary

  • In this presentation we have introduced

    • The SSCLI and its source code distribution

    • SSCLI organization and operation

    • Building and using the SSCLI

    • Opportunities for teaching using the SSCLI

    • Teaching lab deployment issues


Reading and resources

Reading and Resources

Reading

  • Stutz, Neward & Shilling, Shared Source CLI Essentials, O’Reilly & Associates Inc, 2003

    Resources

  • Shared Source CLI

    http://msdn.microsoft.com/msdnmag/issues/02/07/sharedsourcecli/

  • ECMA Specifications

    http://msdn.microsoft.com/net/ecma

  • David Stutz’s MSDN announcement of Rotor

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/Dndotnet/html/mssharsourcecli.asp

  • Jason Whittington’s MSDN Rotor article

    http://msdn.microsoft.com/msdnmag/issues/02/07/sharedsourcecli/


  • Login