Introduction to Computer Systems
اسلاید 1: Introduction to Computer SystemsTopics:ThemeFive great realities of computer systemsHow this fits within CS curriculumCS 213 S’01class01a.ppt15-213“The Class That Gives CMU Its Zip!”Guy Blelloch January 16, 2001
اسلاید 2: Course ThemeAbstraction is good, but don’t forget reality!Courses to date emphasize abstractionAbstract data typesAsymptotic analysisThese abstractions have limitsEspecially in the presence of bugsNeed to understand underlying implementationsUseful outcomesBecome more effective programmersAble to find and eliminate bugs efficientlyAble to tune program performancePrepare for later “systems” classesCompilers, Operating Systems, Networks, Computer Architecture
اسلاید 3: Great Reality #1Int’s are not Integers, Float’s are not RealsExamplesIs x2 ≥ 0?Float’s: Yes!Int’s: 65535 * 65535 --> -131071(On most machines) 65535L * 65535 --> 4292836225(On Alpha)Is (x + y) + z = x + (y + z)?Unsigned Int’s: Yes!Float’s: (1e10 + -1e10) + 3.14 --> 3.14 1e10 + (-1e10 + 3.14) --> 0.0
اسلاید 4: Computer ArithmeticDoes not generate random valuesArithmetic operations have important mathematical propertiesCannot assume “usual” propertiesDue to finiteness of representationsInteger operations satisfy “ring” properties (usually)Commutativity, associativity, distributivityFloating point operations satisfy “ordering” propertiesMonotonicity, values of signsObservationNeed to understand which abstractions apply in which contextsImportant issues for compiler writers and serious application programmers
اسلاید 5: Great Reality #2You’ve got to know assemblyChances are, you’ll never write program in assemblyCompilers are much better at this than you areUnderstanding assembly key to machine-level execution 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
اسلاید 6: Great Reality #3Memory MattersMemory is not unboundedIt must be allocated and managedMany applications are memory dominatedThe memory system can be the largest portion of a machine’s costMemory referencing bugs especially perniciousEffects are distant in both time and spaceMemory performance is not uniformCache and virtual memory effects can greatly affect program performanceAdapting program to characteristics of memory system can lead to major speed improvements
اسلاید 7: Memory Referencing Bug Examplemain (){ long int a[2]; double d = 3.14; a[2] = 1073741824; /* Out of bounds reference */ printf(d = %.15gn, d); exit(0);}AlphaMIPSSun-g5.30498947741318e-3153.13999986648563.14-O3.143.143.14
اسلاید 8: Memory Referencing ErrorsC and C++ do not provide any memory protectionOut of bounds array referencesInvalid pointer valuesAbuses of malloc/freeCan lead to nasty bugsWhether or not bug has any effect system and compiler dependentAction at a distanceCorrupted object logically unrelated to one being accessedEffect of bug may occur long after it occursHow can I deal with this?Program in Java, Lisp, or MLUnderstand what possible interactions may occurUse or develop tools to detect referencing errorsE.g., Purify
اسلاید 9: Memory Performance ExampleImplementations of Matrix MultiplicationMultiple ways to nest loops/* ijk */for (i=0; i<n; i++) { for (j=0; j<n; j++) { sum = 0.0; for (k=0; k<n; k++) sum += a[i][k] * b[k][j]; c[i][j] = sum; }} /* jik */for (j=0; j<n; j++) { for (i=0; i<n; i++) { sum = 0.0; for (k=0; k<n; k++) sum += a[i][k] * b[k][j]; c[i][j] = sum }}
اسلاید 10: 020406080100120140160matrix size (n)ijkikjjikjkikijkjiMatmult Performance (Alpha 21164)Too big for L1 CacheToo big for L2 Cache
اسلاید 11: Blocked matmult perf (Alpha 21164)0204060801001201401605075100125150175200225250275300325350375400425450475500matrix size (n)bijkbikjijkikj
اسلاید 12: Great Reality #4There’s more to performance than asymptotic complexityConstant factors matter too!Easily see 10:1 performance range depending on how code writtenMust optimize at multiple levels: algorithm, data representations, procedures, and loopsMust understand system to optimize performanceHow programs compiled and executedHow to measure program performance and identify bottlenecksHow to improve performance without destroying code modularity and generality
اسلاید 13: Great Reality #5Computers do more than execute programsThey need to get data in and outI/O system critical to program reliability and performanceThey communicate with each other over networksMany system-level issues arise in presence of networkConcurrent operations by autonomous processesCoping with unreliable mediaCross platform compatibilityComplex performance issues
اسلاید 14: Role within CurriculumTransition from Abstract to Concrete!From: high-level language modelTo: underlying implementationCS 211FundamentalStructuresCS 213SystemsCS 412OperatingSystemsCS 411CompilersProcessesMem. MgmtMachine CodeOptimizationData StructuresApplications ProgrammingCS 212ExecutionModelsCS 441NetworksNetworkProtocolsECE 347ArchitectureExec. ModelMemory System
نقد و بررسی ها
هیچ نظری برای این پاورپوینت نوشته نشده است.