Download presentation
Presentation is loading. Please wait.
Published byRudolf Robinson Modified over 9 years ago
2
.NET and the SSCLI as the basis of a Distributed Systems Masters Degree Rob Miles University of Hull, UK
3
Overview Where in the world is Hull? Teaching Undergraduate Computer Science Traditional approaches Traditional approaches Challenges and opportunities Challenges and opportunities Making a.NET-based degree Background, aims and content Background, aims and content The role of.NET, SSCLI (Rotor) and AA programmes The role of.NET, SSCLI (Rotor) and AA programmes Example laboratory exercise Where we are now
5
The Pond Here be Dragons Land of Ice & Snow The World According to Us Hull is in England, east of York and further east of New York! Centre of the Universe
6
What is special about Hull? Hull: Is a busy port city with direct connections to mainland Europe Is a busy port city with direct connections to mainland Europe Around 265,000 inhabitants Around 265,000 inhabitants Is the birthplace of anti-slavery campaigner William Wilberforce Is the birthplace of anti-slavery campaigner William Wilberforce Is the home of one half of the Humber Bridge Is the home of one half of the Humber Bridge Is the cucumber centre of Europe! Is the cucumber centre of Europe!
7
What about the University of Hull ? Founded in 1927 – 75 this year! 15,000 students from 100 countries Broad arts and science focus Graduates amongst the most employable in the U.K. Famous for… ? Inventing liquid crystal technology Inventing liquid crystal technology The poet Philip Larkin, University librarian for over 30 years The poet Philip Larkin, University librarian for over 30 years
8
Computing @ Hull ~ 580 undergraduate students, ~ 60 taught/~ 40 research postgraduates Undergraduate degrees Computer Science, Software Engineering, Business Information Engineering, Internet Computing, Games Development Computer Science, Software Engineering, Business Information Engineering, Internet Computing, Games Development Taught postgraduate degrees Graphics and Visualization, Games Programming, Internet Computing Graphics and Visualization, Games Programming, Internet Computing
9
Undergraduate Computer Science Our approach is fairly conventional: Year One Year One Introduce broad range of underlying theoryIntroduce broad range of underlying theory Year Two Year Two Extend Year One theory with more advanced topics and greater depth of contentExtend Year One theory with more advanced topics and greater depth of content Year Three Year 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 which will serve them well in the future, but these are not fully developed
10
The Challenge Three years is not enough time! To achieve this breadth of coverage we tend to lose the depth We do not have time to expose the students to large systems and appropriate development techniques We have little opportunity to give students all the testing/debugging skills needed by industry
11
The Inspiration At a Microsoft.NET event we were introduced to Rotor Rotor is a freely available version of.NET in source form which: runs on Windows, FreeBSD and MacOS runs on Windows, FreeBSD and MacOS is properly known as the Shared Source Common Language Infrastructure is properly known as the Shared Source Common Language Infrastructure We reckoned we could teach some serious Computer Science with this!
12
The Result In September 2003 we begin teaching the.NET MSc in Distributed Systems Development This degree: is a world first, developed in conjunction with Microsoft UK and the Rotor product team is a world first, developed in conjunction with Microsoft UK and the Rotor product team is a response to the challenges we face at the undergraduate level and the skills that employers require is a response to the challenges we face at the undergraduate level and the skills that employers require uses Microsoft.NET to explore distributed systems concepts uses Microsoft.NET to explore distributed systems concepts uses Rotor to explore the design and implementation of modern languages and distributed computing environments uses Rotor to explore the design and implementation of modern languages and distributed computing environments offers in-depth development of testing and debugging skills using the Rotor source as an example of a large, commercial-quality software system offers in-depth development of testing and debugging skills using the Rotor source as an example of a large, commercial-quality software system
13
.NET Degree – Aims & Content Aims Give advanced coverage of modern distributed computing techniques Give advanced coverage of modern distributed computing 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 by advanced theoretical concepts Provide hands-on practical experience underpinned by advanced theoretical concepts Designed in conjunction with Microsoft, but taught as a genuine academic course Designed in conjunction with Microsoft, but taught as a genuine academic course
14
Degree Structure Three stages: Certificate Stage Skills to underpin the original work Skills to underpin the original work Diploma Stage Advanced computing topics Advanced computing topics Masters Stage Practical deployment of techniques Practical deployment of techniques
15
Certificate Stage
16
Diploma Stage
17
Masters Stage Large, individual project based on real- world problem using Rotor or other commercial-grade software Examples FORTH implementation FORTH implementation Custom Garbage Collection Custom Garbage Collection Custom Remoting / object mobility Custom Remoting / object mobility Code profiling Code profiling
18
The Role of.NET and Rotor .NET provides an overreaching example of distributed systems concepts/techniques Rotor provides “down to the metal” implementation details “down to the metal” implementation details excellent environment for enhancing testing/ debugging skills excellent environment for enhancing testing/ debugging skills Not simply a.NET degree The techniques which are learnt can be applied in any area The techniques which are learnt can be applied in any area
19
Teaching Debugging Some things you have to do before you get good at them: You can read about riding a bike, but this will not necessarily help when you get on one! You can read about riding a bike, but this will not necessarily help when you get on one! Debugging is like this We see the ability to fix broken programmes as an essential skill for Computer Scientists We see the ability to fix broken programmes as an essential skill for Computer Scientists
20
The Art of Debugging Teaching what to do when it all goes wrong is difficult Students will have had to debug their own programs but do not spend much time debugging other peoples In our course we set the “worst case” scenario: There is a problem with the underlying implementation There is a problem with the underlying implementation Their program is fine, but it still doesn’t work! Their program is fine, but it still doesn’t work!
21
A Rotor-based Laboratory Exercise A live demo A debugging exercise from the Extensible Systems module designed to: get the students thinking about all aspects of the compilation/execution cycle (challenges some pre-conceptions?) get the students thinking about all aspects of the compilation/execution cycle (challenges some pre-conceptions?) provide opportunities to develop debugging and testing skills provide opportunities to develop debugging and testing skills familiarise the student with the Rotor code and the techniques used to implement it familiarise the student with the Rotor code and the techniques used to implement it
22
A Simple Sort Student are asked to write a C# program to bubble sort the following numbers static float[] data = {45.0, 6.5, 435.2, 22.0, 6.3, 100.1, 0.02, 99.9, 45.0, 17.4, 56.4}; Being kind people, we even suggest an algorithm Simple bubble sort Simple bubble sort
23
Run the sort with ROTOR Compile and run the program using the Rotor C# compiler and the Rotor CLR: csc bubblesort.cs clix bubblesort.exe Not a happy ending! Something is causing our program to do bad things
24
Finding out more We can use the ROTOR debugging tools to find out more about the problem: cordbg bubblesort.exe contprint We notice that var1 (which is i) has the deeply suspicious value of 10 The 10+1th location is beyond the array
25
Whose fault? At this point the students have to decide if their code is at fault Inexperienced programmers are prone to problems with array bounds Inexperienced programmers are prone to problems with array bounds First they must convince themselves that their program is correct First they must convince themselves that their program is correct They will not expect the language implementation to cause problems They will not expect the language implementation to cause problems
26
Prove the environment Can we verify the correctness of the code in any way? Use Visual Studio 2003 Use Visual Studio 2003 Hypothesis if it works our code must be valid if it works our code must be valid Outcome The program works correctly in this environment The program works correctly in this environment
27
First conclusion Conclusion: Something about the Rotor environment or C# compiler causes the problem Hypotheses Something is wrong with the implementation of for loops? Something is wrong with the implementation of for loops? Something is wrong with the < operator? Something is wrong with the < operator?
28
Isolating the fault We need something to further isolate the problem We have created a program which test the value of the control variables on for loop completion: csc testfor.cs clix testfor.exe Aha! We have a smoking gun..
29
What could be wrong? Something is definitely not right… Hypothesis The C# compiler generates Common Intermediate Language code. Perhaps the code generation is incorrect. The C# compiler generates Common Intermediate Language code. Perhaps the code generation is incorrect. Use ildasm to disassemble the compiler output to see if this hypothesis is correct: ildasm testfor.exe > testfor.il
30
A look at the code IL_0017 looks deeply suspicious It looks remarkably like IL_0079 which is the code for the <= test We can propose the hypothesis that the compiler may be producing the wrong code for the < operation in loops We need to find a way to test this
31
Round Tripping One of the great things about ROTOR is the tool set We can fix the “bug” and re-assemble the assembler produced by the disassembler Ilasm testfor.il clix testfor.exe The code passes the tests now
32
When compilers go bad The compiler is outputting the wrong instruction for <. Why? The parser may be mistaking < for <= but the ROTOR C# compiler is supplied with a pre-built parser (which we can’t break!) but the ROTOR C# compiler is supplied with a pre-built parser (which we can’t break!) The code generation is sending out the wrong instruction for < we should test this first we should test this first
33
Stepping the compiler We can use Visual Studio to step through the compiler and examine the source This is a slightly fraught process, but worth doing: devenv /debugexe %TARGETCOMPLUS%\csc.exe bubblesort.cs Make sure no solution is open before you do this! We are now inside the compiler
34
Code Generation We don’t have much time for this, but the code is generated by a method called genBlock ( ilgen.cpp:754 ) This traverses a tree of statements genStatement ( ilgen.cpp:874) drops out the statements themselves It is driven by a switch which selects other methods
35
Generating Conditionals genCondBranch ( ilgen.cpp:1931 ) has the switch which controls the production of conditional branches This uses a look up table called ILcjInstr ( ilgen.cpp:2011 ) to get the opcode to be produced If this array was wrong, the opcode would be wrong too
36
The villain of the piece We can add print statements to find out what the values of the array indices are when the program runs However, if we find the declaration of this array ( ilgen.cpp:5598 ) we notice that one of the opcodes doesn’t look right There is a CE_BLE where there should be a CE_BLT
37
Fix and test We can test this by fixing the array and rebuilding the compiler Exit from VS first! pushd \sscli\clr\src\csharp buildpopd csc bubblesort.cs clix bubblesort.exe
38
Good News, Bad News It still doesn’t work But the fault is different This time the program just hangs Hypotheses If our source code is correct and the generated IL is correct, the Rotor CLR must be malfunctioning If our source code is correct and the generated IL is correct, the Rotor CLR must be malfunctioning The malfunction relates to the < operator. The malfunction relates to the < operator.
39
True Grit This is where we really find out who the stars are! Does the comparison test fail for different data types (e.g. integers)? No – the error only occurs in floating point comparisons. Note that compiler turns < into bge_un_s Perhaps this is being obeyed incorrectly
40
More detective work We have the CLR source – where do we begin? The CLR has a JIT compiler which compiles IL to native code on the fly compiles 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 comparison perhaps something goes wrong in JIT’ing the comparison Which source file(s) contain the JIT compiler?
41
Inside the run time system Are there any references to BGE_UN_S ? Yes - a switch statement in with opcodes ( fjit.cpp:2958 ) Yes - a switch statement in with opcodes ( fjit.cpp:2958 ) Manually trace all calls from here End up in CLT_R8_helper at ( fjitdef.h:3860 ) which implements the comparison has an error – ‘<=‘ should be ‘<‘ has an error – ‘<=‘ should be ‘<‘
42
Final Fix Solution Alter the <= to < Alter the <= to < Recompile and test Recompile and test pushd \sscli\clr\src\fjit buildpopd clix bubblesort.exe Success! All our tests and the bubble sort now work
43
Process This exercise uses Rotor to confront some of the student’s preconceptions. Most new graduates would: Not produce sufficient test cases to narrow the problem down to the floating point comparison Not produce sufficient test cases to narrow the problem down to the floating point comparison Not suspect the compiler of producing incorrect code Not suspect the compiler of producing incorrect code Think that they had not fixed the compiler after removing the bug Think that they had not fixed the compiler after removing the bug The Rotor source is large and unfamiliar – exactly what they will face in the real world
44
Learning Outcomes Importance of methodical approach Design of test cases Navigation of code base Debugging tools Disassembly tools An introduction to intermediate language Just-In-Time compilation
45
Where we are now We have had a very good response to the course We are presently accepting our first cohort onto the course There 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 in a way that they can use it! we need to give one of these to each student in a way that they can use it!
46
Working with Microsoft Access to Microsoft Engineers Helped us with technical aspects of the material Helped us with technical aspects of the material Helped us ensure that the content of the course is directly relevant to the needs of industry Helped us ensure that the content of the course is directly relevant to the needs of industry Microsoft have been unstinting in their assistance to set up this new course
47
Microsoft Programmes Microsoft are making our job easier MSDN AA Makes most Microsoft tools freely available to staff and students for teaching/research purposes Makes most Microsoft tools freely available to staff and students for teaching/research purposes Shared Source Programme Gives us access to source code of key products (e.g. operating systems, SSCLI) Gives us access to source code of key products (e.g. operating systems, SSCLI)
48
Summary We feel that our.NET degree will significantly enhance the abilities of students and build on an undergraduate course The involvement of Microsoft is crucial We are really looking forward to starting this course (and a bit scared…)
49
..and on a lighter note: Microsoft.NET and its Impact on the Cheese Industry www.lectureinrhyme.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.