Introduction to Computer Systems 15-213 “The Class That Gives CMU Its Zip!” And gives Ithaca?? Introduction to Computer Systems Topics: Theme Four great realities of computer systems Chap 1 in “Computer Systems” book
Course Theme Courses to date emphasize abstraction Abstraction is good, but don’t forget reality! Courses to date emphasize abstraction Abstract data types (e.g., Comp 220) Asymptotic analysis (e.g., Comp 311) These abstractions have limits Especially in the presence of bugs Need to understand underlying implementations Don’t believe what Ali says
Course Theme Useful outcomes Become more effective programmers Able to find and eliminate bugs efficiently Able to tune program performance Prepare for later “systems” classes Programing Languages, Operating Systems, Computer Networks, Complex Systems
The Changes in Computing
Great Reality #1 Information is Bits + Context Examples Source Program: #include <stdio.h> int main() { printf(“hello world\n”); } ASCII representation of the source program (text file): # i n c l u d e <sp> 105 110 99 108 117 100 101 32 < s t d i o . h > 115 116 100 105 111 46 104 62 Etc…. Actual representation on the disk:
Great Reality #1 Information is Bits + Context Examples Source Program: #include <stdio.h> int main() { printf(“hello world\n”); } ASCII representation of the source program (text file): # i n c l u d e <sp> 105 110 99 108 117 100 101 32 < s t d i o . h > 115 116 100 105 111 46 104 62 Etc…. Actual representation on the disk: 00100011 01101001 01100011 01101100 01110101 01100100 …
All information is represented as bits Including disk files, programs in memory, user data in memory, data transferred across the internet, … The only thing that distinguishes data objects is context Same bits may represent an integer, floating-point number, character string, or machine instruction.
Great Reality #1 cont. Int’s are not Integers, Float’s are not Reals Examples Is x2 ≥ 0? Float’s: Yes! Int’s: 40000 * 40000 --> 1600000000 50000 * 50000 --> ?? Is (x + y) + z = x + (y + z)? Unsigned & Signed Int’s: Yes! Float’s: (1e20 + -1e20) + 3.14 --> 3.1 1e20 + (-1e20 + 3.14) --> ?? see Student/comp210/examples/testInt.c see Student/comp210/examples/testFloat.c
Great Reality #1 cont. Int’s are not Integers, Float’s are not Reals Examples Is x2 ≥ 0? Float’s: Yes! Int’s: 40000 * 40000 --> 1600000000 50000 * 50000 --> ?? Is (x + y) + z = x + (y + z)? Unsigned & Signed Int’s: Yes! Float’s: (1e20 + -1e20) + 3.14 --> 3.1 1e20 + (-1e20 + 3.14) --> ?? see Student/comp210/examples/testInt.c -1794967296 0.0 see Student/comp210/examples/testFloat.c
Computer Arithmetic Does not generate random values Arithmetic operations have important mathematical properties Cannot assume “usual” properties Due to finiteness of representations Integer operations satisfy “ring” properties Commutativity, associativity, distributivity Floating point operations satisfy “ordering” properties Monotonicity, values of signs
Computer Arithmetic Observation Need to understand which abstractions apply in which contexts Important issues for compiler writers and serious application programmers