Computer Systems OverviewTextbooksSyllabusCourse ComponentsNotes:CheatingFacilitiesLab RationaleCourse ThemeGreat Reality #1Computer ArithmeticGreat Reality #2Assembly Code ExampleCode to Read CounterSlide 15Measuring TimeGreat Reality #3Memory-Referencing Bug ExampleMemory-Referencing ErrorsMemory Performance ExampleMatmult Performance (Alpha 21164)Blocked matmult perf (Alpha 21164)Great Reality #4Great Reality #5Role within CurriculumCourse PerspectiveCourse Perspective (Cont.)Computer SystemsOverview Computer SystemsOverviewTopics:Topics:Staff, text, and policiesLecture topics and assignmentsLab rationaleCS 105CS 105“Tour of the Black Holes of Computing!”Geoff KuenningFall 2008– 2 –CS 105TextbooksTextbooksRandal E. Bryant and David R. O’Hallaron, Randal E. Bryant and David R. O’Hallaron, “Computer Systems: A Programmer’s Perspective”, Prentice Hall, 2003.Brian Kernighan and Dennis Ritchie, Brian Kernighan and Dennis Ritchie, “The C Programming Language, Second Edition”, Prentice Hall, 1988Larry Miller and Alex QuiliciLarry Miller and Alex QuiliciThe Joy of C, Wiley, 1997– 3 –CS 105SyllabusSyllabusSyllabus on Web: http://www.cs.hmc.edu/~geoff/cs105Calendar defines due datesLabs: cs105submit for some, others have specific directions– 4 –CS 105Course ComponentsCourse ComponentsLecturesLecturesHigher-level conceptsProblems and QuizzesProblems and QuizzesApplied concepts, important tools and skills for labs, clarification of lectures, exam coverageLabsLabsThe heart of the course1 or 2 weeksProvide in-depth understanding of an aspect of systemsProgramming and measurementTime to learn, avoid trying to optimizeTeams of two– 5 –CS 105Notes:Notes:Work groupsWork groupsYou must work in pairs on all labsHonor-code violation to work without your partner! HandinsHandinsCheck calendar.Electronic submissions only.Grading CharacteristicsGrading CharacteristicsLab scores tend to be highSerious handicap if you don’t hand a lab inTests & quizzes typically have a wider range of scoresI.e., they’re primary determinant of your gradeDo your share of lab work and reading, or bomb tests– 6 –CS 105CheatingCheatingWhat is cheating?What is cheating?Sharing code: either by copying (web search, etc), retyping, looking at, or supplying a copy of a file.What is NOT cheating?What is NOT cheating?Helping others use systems or tools.Helping others with high-level design issues.Helping others debug their code.– 7 –CS 105FacilitiesFacilitiesAssignments will use Intel computer systemsAssignments will use Intel computer systemsNot all machines are created alikeSome Macs are PowerPCsEven Intel Macs aren’t necessarily compatibleKnuth is a 64-bit serverWilkes - x86/Linux specifically set up for this classLog in on a Mac, then ssh to WilkesIf you want fancy programs, start X11 firstDirectories are cross-mounted, so you can edit on Knuth or your Mac, and Wilkes will see your files…or ssh into Wilkes from your dormAll programs must run on Wilkes: that’s where we grade– 8 –CS 105Lab Rationale Lab Rationale Each lab has a well-defined goal such as solving a puzzle or Each lab has a well-defined goal such as solving a puzzle or winning a contest. winning a contest. Defusing a binary bombWinning a performance contestDoing a lab should result in new skills and conceptsDoing a lab should result in new skills and conceptsData Lab: computer arithmetic, digital logicBomb Labs: assembly language, using a debugger, understanding the stack Threads Lab: ConcurrencyWe try to use competition in a fun and healthy way.We try to use competition in a fun and healthy way.Set a threshold for full creditPost intermediate results (anonymized) on Web page for glory!– 9 –CS 105Course ThemeCourse ThemeAbstraction is good, but don’t forget reality!Many CS Courses emphasize abstractionMany CS Courses emphasize abstractionAbstract data typesAsymptotic analysisThese abstractions have limitsThese abstractions have limitsEspecially in the presence of bugsNeed to understand underlying implementationsUseful outcomesUseful outcomesBecome more effective programmersAble to find and eliminate bugs efficientlyAble to tune program performancePrepare for later “systems” classes in CSCompilers, Operating Systems, Networks, Computer Architecture, Robotics, etc.– 10 –CS 105Great Reality #1Great Reality #1Ints are not integers, Floats are not reals !!Ints are not integers, Floats are not reals !!ExamplesExamplesIs x2 ≥ 0?Floats: Yes!Ints:» 40000 * 40000 --> 1600000000» 50000 * 50000 --> ??Is (x + y) + z = x + (y + z)?Unsigned & Signed Ints: Yes!Floats:» (1e20 + -1e20) + 3.14 --> 3.14» 1e20 + (-1e20 + 3.14) --> ??– 11 –CS 105Computer ArithmeticComputer ArithmeticDoes not generate random valuesDoes not generate random valuesArithmetic operations have important mathematical properties…BUTCannot assume “usual” propertiesCannot assume “usual” propertiesDue to finiteness of representationsInteger operations satisfy “ring” propertiesCommutativity, associativity, distributivityFloating-point operations satisfy “ordering” propertiesMonotonicity, values of signsObservationObservationNeed to understand which abstractions apply in which contextsImportant issues for compiler writers and serious application programmers– 12 –CS 105Great Reality #2Great Reality #2You’ve got to know assemblyYou’ve got to know assemblyChances are, you’ll never program in assembly…Chances are, you’ll never program in assembly…Compilers are much better & more patient than you areBUTBUT understanding assembly key to machine-level understanding assembly key to machine-level execution modelexecution modelBehavior of programs in presence of bugsHigh-level language model breaks downTuning program performanceUnderstanding sources of program inefficiencyImplementing system softwareCompiler has machine code as targetOperating systems must manage process state– 13 –CS 105Assembly Code ExampleAssembly Code ExampleTime Stamp CounterTime Stamp CounterSpecial 64-bit register in Intel-compatible machinesIncremented every clock cycleRead with rdtsc instructionApplicationApplicationMeasure time required by procedureIn units of clock
View Full Document