View
37
Download
0
Category
Tags:
Preview:
DESCRIPTION
.NET and the SSCLI as the basis of a Distributed Systems Masters Degree. Rob Miles. University of Hull, UK. Overview. Where in the world is Hull? Teaching Undergraduate Computer Science Traditional approaches Challenges and opportunities Making a .NET-based degree - PowerPoint PPT Presentation
Citation preview
.NET and the SSCLI.NET and the SSCLIas the basis of aas the basis of a
Distributed Systems Distributed Systems Masters DegreeMasters Degree
Rob MilesRob Miles
University of Hull, UKUniversity of Hull, UK
OverviewOverview Where in the world is Hull?Where in the world is Hull? Teaching Undergraduate Computer Teaching Undergraduate Computer
ScienceScience Traditional approachesTraditional approaches Challenges and opportunitiesChallenges and opportunities
Making a .NET-based degreeMaking a .NET-based degree Background, aims and contentBackground, aims and content The role of .NET, SSCLI (Rotor) and AA The role of .NET, SSCLI (Rotor) and AA
programmesprogrammes Example laboratory exerciseExample laboratory exercise Where we are nowWhere we are now
ThePond
Here be Dragons
Land of Ice & Snow
The World According to UsThe World According to Us Hull is in England, east of York and further east of New York!Hull is in England, east of York and further east of New York!
Centre of the Universe
What is special about Hull?What is special about Hull?
Hull: Hull: Is a busy port city with direct connections to Is a busy port city with direct connections to
mainland Europemainland Europe Around 265,000 inhabitantsAround 265,000 inhabitants Is the birthplace of anti-slavery campaigner Is the birthplace of anti-slavery campaigner
William WilberforceWilliam Wilberforce Is the home of one half of the Humber BridgeIs the home of one half of the Humber Bridge Is the cucumber centre of Europe!Is the cucumber centre of Europe!
What about the University of Hull ?What about the University of Hull ?
Founded in 1927 – 75 this year!Founded in 1927 – 75 this year! 15,000 students from 100 countries15,000 students from 100 countries Broad arts and science focusBroad arts and science focus Graduates amongst the most employable Graduates amongst the most employable
in the U.K.in the U.K. Famous for… ?Famous for… ?
Inventing liquid crystal technologyInventing liquid crystal technology The poet Philip Larkin, University librarian for The poet Philip Larkin, University librarian for
over 30 yearsover 30 years
Computing @ HullComputing @ Hull
~ 580 undergraduate students, ~ 580 undergraduate students, ~ 60 taught/~ 40 research postgraduates ~ 60 taught/~ 40 research postgraduates Undergraduate degrees Undergraduate degrees
Computer Science, Software Engineering, Computer Science, Software Engineering, Business Information Engineering, Internet Business Information Engineering, Internet Computing, Games DevelopmentComputing, Games Development
Taught postgraduate degrees Taught postgraduate degrees Graphics and Visualization, Games Graphics and Visualization, Games
Programming, Internet ComputingProgramming, Internet Computing
Undergraduate Computer ScienceUndergraduate Computer Science
Our approach is fairly conventional:Our approach is fairly conventional: Year OneYear One
• Introduce broad range of underlying theory Introduce broad range of underlying theory Year TwoYear Two
• Extend Year One theory with more advanced topics and Extend Year One theory with more advanced topics and greater depth of contentgreater depth of content
Year ThreeYear Three• Individual specialism and further advanced topicsIndividual specialism and further advanced topics• Large individual software projectLarge individual software project
Our graduates have a broad range of skills Our graduates have a broad range of skills which will serve them well in the future, but which will serve them well in the future, but these are not fully developedthese are not fully developed
The ChallengeThe Challenge
Three years is not enough time!Three years is not enough time! To achieve this breadth of coverage we To achieve this breadth of coverage we
tend to lose the depthtend to lose the depth We do not have time to expose the We do not have time to expose the
students to large systems and appropriate students to large systems and appropriate development techniquesdevelopment techniques
We have little opportunity to give students We have little opportunity to give students all the testing/debugging skills needed by all the testing/debugging skills needed by industryindustry
The InspirationThe Inspiration
At a Microsoft .NET event we were At a Microsoft .NET event we were introduced to Rotorintroduced to Rotor
Rotor is a freely available version of .NET Rotor is a freely available version of .NET in source form which:in source form which: runs on Windows, FreeBSD and MacOSruns on Windows, FreeBSD and MacOS is properly known as the is properly known as the Shared Source Shared Source
Common Language InfrastructureCommon Language Infrastructure We reckoned we could teach some We reckoned we could teach some
serious Computer Science with this!serious Computer Science with this!
The ResultThe Result
In September 2003 we begin teaching the .NET MSc in In September 2003 we begin teaching the .NET MSc in Distributed Systems DevelopmentDistributed Systems Development
This degree:This degree: is a world first, developed in conjunction with Microsoft UK and is a world first, developed in conjunction with Microsoft UK and
the Rotor product team the Rotor product team is a response to the challenges we face at the undergraduate is a response to the challenges we face at the undergraduate
level and the skills that employers requirelevel and the skills that employers require uses Microsoft .NET to explore distributed systems conceptsuses Microsoft .NET to explore distributed systems concepts uses Rotor to explore the design and implementation of modern uses Rotor to explore the design and implementation of modern
languages and distributed computing environments languages and distributed computing environments offers in-depth development of testing and debugging skills offers in-depth development of testing and debugging skills
using the Rotor source as an example of a large, commercial-using the Rotor source as an example of a large, commercial-quality software systemquality software system
.NET Degree – Aims & Content.NET Degree – Aims & Content
AimsAims Give advanced coverage of modern distributed Give advanced coverage of modern distributed
computing techniquescomputing techniques Develop skills in working with large codebases Develop skills in working with large codebases To develop “active practitioners”To develop “active practitioners” Provide hands-on practical experience underpinned Provide hands-on practical experience underpinned
by advanced theoretical conceptsby advanced theoretical concepts Designed in conjunction with Microsoft, but taught as Designed in conjunction with Microsoft, but taught as
a genuine academic coursea genuine academic course
Degree StructureDegree Structure
Three stages:Three stages: Certificate StageCertificate Stage
Skills to underpin the original workSkills to underpin the original work Diploma StageDiploma Stage
Advanced computing topicsAdvanced computing topics Masters StageMasters Stage
Practical deployment of techniquesPractical deployment of techniques
Certificate StageCertificate StageIntroduction to C# Introduction to .NET Extensible Systems
Object oriented design and development
Object oriented programming using C#
Software engineering/ UML design
Testing and debugging skills
Component based development
Managed code environments
Framework components
Common Language Runtime
Common Type System
Navigating, understanding, modifying and maintaining large-scale, commercial quality source code
Testing and debugging strategies
Commercial development skills
Shared-source .NET as an example of large-scale commercial quality software
Diploma StageDiploma StageDistributed
Programming Virtual Machine Architectures
Trustworthy Computing
Architectures and paradigms for distributed computing
.NET support for networking and distributed computing
Remoting & Web services
Mobile computing, telephony & wireless networking
Requirements for managed code environments
Intermediate languages and their design
Virtual Machine architecture and implementation
Shared source .NET implementation
Security risks and the need for security
Trust and authentication
Security techniques and algorithms
Language security
Security in distributed systems
.NET & Rotor security models
Masters StageMasters Stage
Large, individual project based on real-Large, individual project based on real-world problem using Rotor or other world problem using Rotor or other commercial-grade softwarecommercial-grade software
ExamplesExamples FORTH implementationFORTH implementation Custom Garbage CollectionCustom Garbage Collection Custom Remoting / object mobilityCustom Remoting / object mobility Code profilingCode profiling
The Role of .NET and RotorThe Role of .NET and Rotor
.NET provides an overreaching example of .NET provides an overreaching example of distributed systems concepts/techniquesdistributed systems concepts/techniques
Rotor provides Rotor provides ““down to the metal” implementation detailsdown to the metal” implementation details excellent environment for enhancing testing/ excellent environment for enhancing testing/
debugging skillsdebugging skills Not simply a .NET degreeNot simply a .NET degree
The techniques which are learnt can be The techniques which are learnt can be applied in any areaapplied in any area
Teaching DebuggingTeaching Debugging
Some things you have to do before you Some things you have to do before you get good at them:get good at them: You can read about riding a bike, but this will You can read about riding a bike, but this will
not necessarily help when you get on one!not necessarily help when you get on one! Debugging is like thisDebugging is like this
We see the ability to fix broken programmes We see the ability to fix broken programmes as an essential skill for Computer Scientistsas an essential skill for Computer Scientists
The Art of DebuggingThe Art of Debugging
Teaching what to do when it all goes wrong is Teaching what to do when it all goes wrong is difficultdifficult
Students will have had to debug their own Students will have had to debug their own programs but do not spend much time programs but do not spend much time debugging other peoplesdebugging other peoples
In our course we set the “worst case” scenario:In our course we set the “worst case” scenario: There is a problem with the underlying There is a problem with the underlying
implementationimplementation Their program is fine, but it still doesn’t work!Their program is fine, but it still doesn’t work!
A Rotor-based Laboratory ExerciseA Rotor-based Laboratory Exercise
A live demoA live demo A debugging exercise from the Extensible A debugging exercise from the Extensible
Systems module designed to:Systems module designed to: get the students thinking about all aspects of get the students thinking about all aspects of
the compilation/execution cycle (challenges the compilation/execution cycle (challenges some pre-conceptions?)some pre-conceptions?)
provide opportunities to develop debugging provide opportunities to develop debugging and testing skillsand testing skills
familiarise the student with the Rotor code familiarise the student with the Rotor code and the techniques used to implement itand the techniques used to implement it
A Simple SortA Simple Sort
Student are asked to write a C# program Student are asked to write a C# program to bubble sort the following numbersto bubble sort the following numbersstatic float[] data = {45.0, 6.5, static float[] data = {45.0, 6.5, 435.2, 22.0, 6.3, 100.1, 0.02, 435.2, 22.0, 6.3, 100.1, 0.02, 99.9, 45.0, 17.4, 56.4};99.9, 45.0, 17.4, 56.4};
Being kind people, we even suggest an Being kind people, we even suggest an algorithmalgorithm Simple bubble sortSimple bubble sort
Run the sort with ROTORRun the sort with ROTOR
Compile and run the program using the Compile and run the program using the Rotor C# compiler and the Rotor CLR:Rotor C# compiler and the Rotor CLR:csc bubblesort.cscsc bubblesort.cs
clix bubblesort.execlix bubblesort.exe Not a happy ending!Not a happy ending! Something is causing our program to do Something is causing our program to do
bad thingsbad things
Finding out moreFinding out more
We can use the ROTOR debugging tools We can use the ROTOR debugging tools to find out more about the problem:to find out more about the problem:cordbg bubblesort.execordbg bubblesort.exe
contcont
printprint We notice that var1 (which is i) has the We notice that var1 (which is i) has the
deeply suspicious value of 10deeply suspicious value of 10 The 10+1th location is beyond the arrayThe 10+1th location is beyond the array
Whose fault?Whose fault?
At this point the students have to decide if At this point the students have to decide if their code is at faulttheir code is at fault Inexperienced programmers are prone to Inexperienced programmers are prone to
problems with array boundsproblems with array bounds First they must convince themselves that their First they must convince themselves that their
program is correctprogram is correct They will not expect the language They will not expect the language
implementation to cause problemsimplementation to cause problems
Prove the environmentProve the environment
Can we verify the correctness of the code Can we verify the correctness of the code in any way?in any way? Use Visual Studio 2003 Use Visual Studio 2003
HypothesisHypothesis if it works our code must be validif it works our code must be valid
OutcomeOutcome The program works correctly in this The program works correctly in this
environmentenvironment
First conclusionFirst conclusion
Conclusion:Conclusion: Something about the Rotor environment or Something about the Rotor environment or
C# compiler causes the problemC# compiler causes the problem HypothesesHypotheses
Something is wrong with the implementation Something is wrong with the implementation of for loops? of for loops?
Something is wrong with the < operator?Something is wrong with the < operator?
Isolating the faultIsolating the fault
We need something to further isolate the We need something to further isolate the problemproblem
We have created a program which test the We have created a program which test the value of the control variables on for loop value of the control variables on for loop completion:completion:csc testfor.cscsc testfor.cs
clix testfor.execlix testfor.exe Aha! We have a smoking gun..Aha! We have a smoking gun..
What could be wrong?What could be wrong?
Something is definitely not right… Something is definitely not right… HypothesisHypothesis
The C# compiler generates Common The C# compiler generates Common Intermediate Language code. Perhaps the Intermediate Language code. Perhaps the code generation is incorrect.code generation is incorrect.
Use Use ildasmildasm to disassemble the compiler to disassemble the compiler output to see if this hypothesis is correct:output to see if this hypothesis is correct:ildasm testfor.exe > testfor.ilildasm testfor.exe > testfor.il
A look at the codeA look at the code
IL_0017 looks deeply suspiciousIL_0017 looks deeply suspicious It looks remarkably like IL_0079 which is It looks remarkably like IL_0079 which is
the code for the <= testthe code for the <= test We can propose the hypothesis that the We can propose the hypothesis that the
compiler may be producing the wrong compiler may be producing the wrong code for the < operation in loopscode for the < operation in loops
We need to find a way to test thisWe need to find a way to test this
Round TrippingRound Tripping
One of the great things about ROTOR is One of the great things about ROTOR is the tool setthe tool set
We can fix the “bug” and re-assemble the We can fix the “bug” and re-assemble the assembler produced by the disassemblerassembler produced by the disassemblerIlasm testfor.ilIlasm testfor.il
clix testfor.execlix testfor.exe The code passes the tests nowThe code passes the tests now
When compilers go badWhen compilers go bad
The compiler is outputting the wrong The compiler is outputting the wrong instruction for <. Why?instruction for <. Why?
The parser may be mistaking < for <=The parser may be mistaking < for <= but the ROTOR C# compiler is supplied with a but the ROTOR C# compiler is supplied with a
pre-built parser (which we can’t break!)pre-built parser (which we can’t break!) The code generation is sending out the The code generation is sending out the
wrong instruction for <wrong instruction for < we should test this firstwe should test this first
Stepping the compilerStepping the compiler
We can use Visual Studio to step through We can use Visual Studio to step through the compiler and examine the sourcethe compiler and examine the source
This is a slightly fraught process, but worth This is a slightly fraught process, but worth doing:doing:devenv /debugexe %TARGETCOMPLUS%\csc.exe bubblesort.csdevenv /debugexe %TARGETCOMPLUS%\csc.exe bubblesort.cs
Make sure no solution is open before you Make sure no solution is open before you do this!do this!
We are now inside the compiler We are now inside the compiler
Code GenerationCode Generation
We don’t have much time for this, but the We don’t have much time for this, but the code is generated by a method called code is generated by a method called genBlock (genBlock (ilgen.cpp:754ilgen.cpp:754))
This traverses a tree of statementsThis traverses a tree of statements genStatement (genStatement (ilgen.cpp:874) ilgen.cpp:874) drops drops
out the statements themselvesout the statements themselves It is driven by a switch which selects other It is driven by a switch which selects other
methods methods
Generating ConditionalsGenerating Conditionals
genCondBranch (genCondBranch (ilgen.cpp:1931ilgen.cpp:1931) has ) has the switch which controls the production of the switch which controls the production of conditional branchesconditional branches
This uses a look up table called ILcjInstr This uses a look up table called ILcjInstr ((ilgen.cpp:2011ilgen.cpp:2011) to get the opcode to ) to get the opcode to be producedbe produced
If this array was wrong, the opcode would If this array was wrong, the opcode would be wrong toobe wrong too
The villain of the pieceThe villain of the piece
We can add print statements to find out We can add print statements to find out what the values of the array indices are what the values of the array indices are when the program runswhen the program runs
However, if we find the declaration of this However, if we find the declaration of this array (array (ilgen.cpp:5598ilgen.cpp:5598) we notice that ) we notice that one of the opcodes doesn’t look rightone of the opcodes doesn’t look right
There is a CE_BLE where there should be There is a CE_BLE where there should be a CE_BLTa CE_BLT
Fix and testFix and test
We can test this by fixing the array and We can test this by fixing the array and rebuilding the compilerrebuilding the compiler
Exit from VS first!Exit from VS first!pushd \sscli\clr\src\csharppushd \sscli\clr\src\csharp
buildbuild
popdpopd
csc bubblesort.cscsc bubblesort.cs
clix bubblesort.execlix bubblesort.exe
Good News, Bad NewsGood News, Bad News
It still doesn’t workIt still doesn’t work But the fault is differentBut the fault is different This time the program just hangsThis time the program just hangs HypothesesHypotheses
If our source code is correct and the generated IL is If our source code is correct and the generated IL is correct, the Rotor CLR must be malfunctioningcorrect, the Rotor CLR must be malfunctioning
The malfunction relates to the < operator.The malfunction relates to the < operator.
True GritTrue Grit
This is where we really find out who the stars This is where we really find out who the stars are!are!
Does the comparison test fail for different data Does the comparison test fail for different data types (e.g. integers)? types (e.g. integers)?
No – the error only occurs in floating point No – the error only occurs in floating point comparisons. Note that compiler turns < into comparisons. Note that compiler turns < into bge_un_sbge_un_s
Perhaps this is being obeyed incorrectlyPerhaps this is being obeyed incorrectly
More detective workMore detective work
We have the CLR source – where do we We have the CLR source – where do we begin?begin?
The CLR has a JIT compiler whichThe CLR has a JIT compiler which compiles IL to native code on the flycompiles IL to native code on the fly would be a good place to start looking would be a good place to start looking perhaps something goes wrong in JIT’ing the perhaps something goes wrong in JIT’ing the
comparisoncomparison Which source file(s) contain the JIT Which source file(s) contain the JIT
compiler?compiler?
Inside the run time systemInside the run time system
Are there any references to Are there any references to BGE_UN_SBGE_UN_S?? Yes - a Yes - a switchswitch statement in with opcodes statement in with opcodes
((fjit.cpp:2958fjit.cpp:2958) ) Manually trace all calls from hereManually trace all calls from here End up in End up in CLT_R8_helperCLT_R8_helper at at
((fjitdef.h:3860fjitdef.h:3860) which implements the ) which implements the comparisoncomparison has an error – ‘<=‘ should be ‘<‘has an error – ‘<=‘ should be ‘<‘
Final FixFinal Fix
SolutionSolution Alter the <= to <Alter the <= to < Recompile and testRecompile and testpushd \sscli\clr\src\fjitpushd \sscli\clr\src\fjitbuildbuildpopdpopdclix bubblesort.execlix bubblesort.exe
Success! All our tests and the bubble sort Success! All our tests and the bubble sort now worknow work
ProcessProcess
This exercise uses Rotor to confront some of the This exercise uses Rotor to confront some of the student’s preconceptions.student’s preconceptions.
Most new graduates would:Most new graduates would: Not produce sufficient test cases to narrow the Not produce sufficient test cases to narrow the
problem down to the floating point comparisonproblem down to the floating point comparison Not suspect the compiler of producing incorrect codeNot suspect the compiler of producing incorrect code Think that they had not fixed the compiler after Think that they had not fixed the compiler after
removing the bugremoving the bug
The Rotor source is large and unfamiliar – The Rotor source is large and unfamiliar – exactly what they will face in the real worldexactly what they will face in the real world
Learning OutcomesLearning Outcomes
Importance of methodical approach Importance of methodical approach Design of test casesDesign of test cases Navigation of code baseNavigation of code base Debugging toolsDebugging tools Disassembly toolsDisassembly tools An introduction to intermediate languageAn introduction to intermediate language Just-In-Time compilationJust-In-Time compilation
Where we are nowWhere we are now
We have had a very good response to the We have had a very good response to the coursecourse
We are presently accepting our first cohort We are presently accepting our first cohort onto the courseonto the course
There are some “interesting” issuesThere are some “interesting” issues the sscli directory is over 560MB the sscli directory is over 560MB we need to give one of these to each student we need to give one of these to each student
in a way that they can use it!in a way that they can use it!
Working with MicrosoftWorking with Microsoft
Access to Microsoft EngineersAccess to Microsoft Engineers Helped us with technical aspects of the Helped us with technical aspects of the
materialmaterial Helped us ensure that the content of the Helped us ensure that the content of the
course is directly relevant to the needs of course is directly relevant to the needs of industryindustry
Microsoft have been unstinting in their Microsoft have been unstinting in their assistance to set up this new courseassistance to set up this new course
Microsoft ProgrammesMicrosoft Programmes
Microsoft are making our job easierMicrosoft are making our job easier MSDN AAMSDN AA
Makes most Microsoft tools freely available to Makes most Microsoft tools freely available to staff and students for teaching/research staff and students for teaching/research purposespurposes
Shared Source ProgrammeShared Source Programme Gives us access to source code of key Gives us access to source code of key
products (e.g. operating systems, SSCLI)products (e.g. operating systems, SSCLI)
SummarySummary
We feel that our .NET degree will We feel that our .NET degree will significantly enhance the abilities of significantly enhance the abilities of students and build on an undergraduate students and build on an undergraduate coursecourse
The involvement of Microsoft is crucialThe involvement of Microsoft is crucial We are really looking forward to starting We are really looking forward to starting
this course (and a bit scared…)this course (and a bit scared…)
..and on a lighter note:
Microsoft .NET and its Impact on the Cheese Industry
www.lectureinrhyme.comwww.lectureinrhyme.com
Recommended