






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A summary of the course Introduction to Computer Systems taught by Don Fussell at the University of Texas at Austin in Fall 2011. The course covers topics such as the five great realities of computer systems, the importance of understanding assembly, and memory management. examples of assembly code and memory referencing bugs. The course is intended to help students become more effective programmers and prepare for later systems classes in CS such as compilers, operating systems, networks, and computer architecture.
Typology: Lecture notes
1 / 30
This page cannot be seen from the preview
Don't miss anything!























Theme Five great realities of computer systems How this fits within CS curriculum
Able to find and eliminate bugs efficiently Able to tune program performance
Compilers, Operating Systems, Networks, Computer Architecture, etc.
Commutativity, associativity, distributivity
Monotonicity, values of signs
High-level language model breaks down
Understanding sources of program inefficiency
Compiler has machine code as target Operating systems must manage process state
*static unsigned cyc_hi = 0; static unsigned cyc_lo = 0; / Set *hi and lo to the high and low order bits of the cycle counter. / void access_counter(unsigned hi, unsigned lo) { asm( "rdtsc; movl %%edx,%0; movl %%eax,%1 " : "=r" (hi), "=r" (lo) : : "%edx", "%eax"); }
/ Record the current value of the cycle counter. / void start_counter() { access_counter(&cyc_hi, &cyc_lo); } / Number of cycles since the last call to start_counter. / double get_counter() { unsigned ncyc_hi, ncyc_lo; unsigned hi, lo, borrow; / Get cycle counter / access_counter(&ncyc_hi, &ncyc_lo); / Do double precision subtraction / lo = ncyc_lo - cyc_lo; borrow = lo > ncyc_lo; hi = ncyc_hi - cyc_hi - borrow; return (double) hi * (1 << 30) * 4 + lo; }
main () { long int a[2]; double d = 3.14; a[2] = 1073741824; / Out of bounds reference / printf("d = %.15g\n", d); exit(0); } Alpha MIPS Linux -g 5.30498947741318e-315 3.1399998664856 3. -O 3.14 3.14 3. (Linux version gives correct result, but implementing as separate function gives segmentation fault.)
/ 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 } }
0 20 40 60 80 100 120 140 160 matrix size (n) ijk ikj jik jki kij kji
Too big for L1 Cache Too big for L2 Cache
Concurrent operations by autonomous processes Coping with unreliable media Cross platform compatibility Complex performance issues
Write programs that are more reliable and efficient Incorporate features that require hooks into OS E.g., concurrency, signal handlers
We bring out the hidden hacker in everyone
Office: ACES 2. Office Hours: MW 11- Email: [email protected] http://www.cs.utexas.edu/~fussell/
Office: TBD Office Hours: TBD Email: [email protected] http://www.cs.utexas.edu/~ckm