1 / 49

.NET and the SSCLI as the basis of a Distributed Systems Masters Degree

.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

kawena
Download Presentation

.NET and the SSCLI as the basis of a Distributed Systems Masters Degree

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. .NET and the SSCLIas the basis of aDistributed Systems Masters Degree Rob Miles University of Hull, UK

  2. Overview • Where in the world is Hull? • Teaching Undergraduate Computer Science • Traditional approaches • Challenges and opportunities • Making a .NET-based degree • Background, aims and content • The role of .NET, SSCLI (Rotor) and AA programmes • Example laboratory exercise • Where we are now

  3. Land of Ice & Snow The Pond Here be Dragons Centre of the Universe The World According to Us • Hull is in England, east of York and further east of New York!

  4. What is special about Hull? • Hull: • Is a busy port city with direct connections to mainland Europe • Around 265,000 inhabitants • Is the birthplace of anti-slavery campaigner William Wilberforce • Is the home of one half of the Humber Bridge • Is the cucumber centre of Europe!

  5. 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 • The poet Philip Larkin, University librarian for over 30 years

  6. Computing @ Hull • ~ 580 undergraduate students, • ~ 60 taught/~ 40 research postgraduates • Undergraduate degrees • Computer Science, Software Engineering, Business Information Engineering, Internet Computing, Games Development • Taught postgraduate degrees • Graphics and Visualization, Games Programming, Internet Computing

  7. Undergraduate Computer Science • Our approach is fairly conventional: • Year One • Introduce broad range of underlying theory • Year Two • Extend Year One theory with more advanced topics and greater depth of content • Year Three • Individual specialism and further advanced topics • Large 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

  8. 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

  9. 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 • is properly known as the Shared Source Common Language Infrastructure • We reckoned we could teach some serious Computer Science with this!

  10. 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 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 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

  11. .NET Degree – Aims & Content • Aims • Give advanced coverage of modern distributed computing techniques • Develop skills in working with large codebases • To develop “active practitioners” • Provide hands-on practical experience underpinned by advanced theoretical concepts • Designed in conjunction with Microsoft, but taught as a genuine academic course

  12. Degree Structure • Three stages: • Certificate Stage • Skills to underpin the original work • Diploma Stage • Advanced computing topics • Masters Stage • Practical deployment of techniques

  13. Certificate Stage

  14. Diploma Stage

  15. Masters Stage • Large, individual project based on real-world problem using Rotor or other commercial-grade software • Examples • FORTH implementation • Custom Garbage Collection • Custom Remoting / object mobility • Code profiling

  16. The Role of .NET and Rotor • .NET provides an overreaching example of distributed systems concepts/techniques • Rotor provides • “down to the metal” implementation details • excellent environment for enhancing testing/ debugging skills • Not simply a .NET degree • The techniques which are learnt can be applied in any area

  17. 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! • Debugging is like this • We see the ability to fix broken programmes as an essential skill for Computer Scientists

  18. 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 • Their program is fine, but it still doesn’t work!

  19. 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?) • provide opportunities to develop debugging and testing skills • familiarise the student with the Rotor code and the techniques used to implement it

  20. 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

  21. 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

  22. Finding out more • We can use the ROTOR debugging tools to find out more about the problem: cordbg bubblesort.exe cont print • We notice that var1 (which is i) has the deeply suspicious value of 10 • The 10+1th location is beyond the array

  23. 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 • First they must convince themselves that their program is correct • They will not expect the language implementation to cause problems

  24. Prove the environment • Can we verify the correctness of the code in any way? • Use Visual Studio 2003 • Hypothesis • if it works our code must be valid • Outcome • The program works correctly in this environment

  25. 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 < operator?

  26. 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..

  27. What could be wrong? • Something is definitely not right… • Hypothesis • 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

  28. 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

  29. 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

  30. 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!) • The code generation is sending out the wrong instruction for < • we should test this first

  31. 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

  32. 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

  33. 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

  34. 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

  35. Fix and test • We can test this by fixing the array and rebuilding the compiler • Exit from VS first! pushd \sscli\clr\src\csharp build popd csc bubblesort.cs clix bubblesort.exe

  36. 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 • The malfunction relates to the < operator.

  37. 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

  38. 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 • would be a good place to start looking • perhaps something goes wrong in JIT’ing the comparison • Which source file(s) contain the JIT compiler?

  39. Inside the run time system • Are there any references to BGE_UN_S? • 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 ‘<‘

  40. Final Fix • Solution • Alter the <= to < • Recompile and test pushd \sscli\clr\src\fjit build popd clix bubblesort.exe • Success! All our tests and the bubble sort now work

  41. 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 suspect the compiler of producing incorrect code • 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

  42. 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

  43. 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 • we need to give one of these to each student in a way that they can use it!

  44. Working with Microsoft • Access to Microsoft Engineers • 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 • Microsoft have been unstinting in their assistance to set up this new course

  45. Microsoft Programmes • Microsoft are making our job easier • MSDN AA • 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)

  46. 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…)

  47. ..and on a lighter note: Microsoft .NET and its Impact on the Cheese Industry www.lectureinrhyme.com

More Related