0% found this document useful (0 votes)
88 views29 pages

Introduction To Computer Systems: The Course That Gives CMU Its "Zip"!

This document provides an overview of an introduction to computer systems course at Carnegie Mellon University. It discusses the role of the course in the CS/ECE curriculum. It outlines five realities of computer systems that the course will cover: 1) integers and floats do not behave like mathematical integers and reals, 2) understanding assembly is key, 3) memory matters and bugs can occur from improper memory usage, 4) performance optimization requires understanding more than just algorithm complexity, and 5) computers must perform input/output and network communication.

Uploaded by

darwinvargas2011
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views29 pages

Introduction To Computer Systems: The Course That Gives CMU Its "Zip"!

This document provides an overview of an introduction to computer systems course at Carnegie Mellon University. It discusses the role of the course in the CS/ECE curriculum. It outlines five realities of computer systems that the course will cover: 1) integers and floats do not behave like mathematical integers and reals, 2) understanding assembly is key, 3) memory matters and bugs can occur from improper memory usage, 4) performance optimization requires understanding more than just algorithm complexity, and 5) computers must perform input/output and network communication.

Uploaded by

darwinvargas2011
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Carnegie Mellon

Introduction to Computer Systems
15‐213/18‐243, Spring 2009
1st Lecture, Aug. 25th

Instructors:
Roger Dannenberg and Greg Ganger

The course that gives CMU its “Zip”! 
Carnegie Mellon

Overview
„ Course role and theme
„ Five realities
„ Logistics
Carnegie Mellon

Role within CS/ECE Curriculum
CS 412
OS Practicum

CS 410 ECE 349 ECE 348


CS 415 CS 441 CS 411 CS 462 ECE 447
Operating Embedded Embedded
Databases Networks Compilers Graphics Architecture
Systems Systems System Eng.

Data Reps. Network Processes Machine


Protocols Mem. Mgmt Code Arithmetic Execution Model
Memory Model Memory System

CS 213
ECE 243 Foundation of Computer Systems
Underlying principles for hardware, 
software, and networking

CS 123
C Programming
Carnegie Mellon

Course Perspective
„ Most Systems Courses are Builder‐Centric
ƒ Computer Architecture
ƒDesign pipelined processor in Verilog
ƒ Operating Systems
ƒ Implement large portions of operating system
ƒ Embedded Systems
ƒ Implement small‐scale embedded systems
ƒ Networking
ƒ Implement and simulate network protocols
Carnegie Mellon

Course Perspective (Cont.)
„ Our Course is Programmer‐Centric
ƒ Purpose is to show how by knowing more about the underlying 
system, one can be more effective as a programmer
ƒ Enable you to
ƒ Write programs that are more reliable and efficient
ƒ Incorporate features that require hooks into OS
– E.g., concurrency, signal handlers
ƒ Not just a course for dedicated hackers
ƒ We bring out the hidden hacker in everyone
ƒ Cover material in this course that you won’t see elsewhere
Carnegie Mellon

Course Theme:
Abstraction Is Good But Don’t Forget Reality
„ Most CS courses emphasize abstraction
ƒ Abstract data types
ƒ Asymptotic analysis
„ These abstractions have limits
ƒ Especially in the presence of bugs
ƒ Need to understand details of underlying implementations
„ Useful outcomes
ƒ Become more effective programmers
ƒAble to find and eliminate bugs efficiently
ƒ Able to understand and tune for program performance
ƒ Prepare for later “systems” classes in CS & ECE
ƒ Compilers, Operating Systems, Networks, Computer Architecture, 
Embedded Systems
Carnegie Mellon

Great Reality #1: 
Int’s are not Integers, Float’s are not Reals
„ Example 1: Is x2 ≥ 0?
ƒ Float’s: Yes!
ƒ Int’s:
ƒ 40000 * 40000 ‐‐> 1600000000
ƒ 50000 * 50000 ‐‐> ??

„ Example 2: Is (x + y) + z  =  x + (y + z)?
ƒ Unsigned & Signed Int’s: Yes!
ƒ Float’s:
ƒ (1e20 + ‐1e20) + 3.14 ‐‐> 3.14
ƒ 1e20 + (‐1e20 + 3.14) ‐‐> ??
Carnegie Mellon

Computer Arithmetic
„ Does not generate random values
ƒ Arithmetic operations have important mathematical properties
„ Cannot assume all “usual” mathematical properties
ƒ Due to finiteness of representations
ƒ Integer operations satisfy “ring” properties
ƒ Commutativity, associativity, distributivity
ƒ Floating point operations satisfy “ordering” properties
ƒ Monotonicity, values of signs

„ Observation
ƒ Need to understand which abstractions apply in which contexts
ƒ Important issues for compiler writers and serious application 
programmers
Carnegie Mellon

Great Reality #2: 
You’ve Got to Know Assembly
„ Chances are, you’ll never write program in assembly
ƒ Compilers are much better & more patient than you are
„ But: Understanding assembly key to machine‐level 
execution model
ƒ Behavior of programs in presence of bugs
ƒ High‐level language model breaks down
ƒ Tuning program performance
ƒ Understand optimizations done/not done by the compiler
ƒ Understanding sources of program inefficiency
ƒ Implementing system software
ƒ Compiler has machine code as target
ƒ Operating systems must manage process state
ƒ Creating / fighting malware
ƒ x86 assembly is the language of choice!
Carnegie Mellon

Great Reality #3: Memory Matters
Random Access Memory Is an Unphysical Abstraction

„ Memory is not unbounded
ƒ It must be allocated and managed
ƒ Many applications are memory dominated
„ Memory referencing bugs especially pernicious
ƒ Effects are distant in both time and space
„ Memory performance is not uniform
ƒ Cache and virtual memory effects can greatly affect program 
performance
ƒ Adapting program to characteristics of memory system can lead to
major speed improvements
Carnegie Mellon

Memory Referencing Bug Example
double fun(int i)
{
volatile double d[1] = {3.14};
volatile long int a[2];
a[i] = 1073741824; /* Possibly out of bounds */
return d[0];
}

fun(0) –> 3.14


fun(1) –> 3.14
fun(2) –> 3.1399998664856
fun(3) –> 2.00000061035156
fun(4) –> 3.14, then segmentation fault
Carnegie Mellon

Memory Referencing Bug Example
double fun(int i)
{
volatile double d[1] = {3.14};
volatile long int a[2];
a[i] = 1073741824; /* Possibly out of bounds */
return d[0];
}

fun(0) –> 3.14


fun(1) –> 3.14
fun(2) –> 3.1399998664856
fun(3) –> 2.00000061035156
fun(4) –> 3.14, then segmentation fault

Explanation: Saved State 4


d7 … d4 3
Location accessed by 
d3 … d0 2
fun(i)
a[1] 1
a[0] 0
Carnegie Mellon

Memory Referencing Errors
„ C and C++ do not provide any memory protection
ƒ Out of bounds array references
ƒ Invalid pointer values
ƒ Abuses of malloc/free
„ Can lead to nasty bugs
ƒ Whether or not bug has any effect depends on system and compiler
ƒ Action at a distance
ƒ Corrupted object logically unrelated to one being accessed
ƒ Effect of bug may be first observed long after it is generated

„ How can I deal with this?
ƒ Program in Java or ML
ƒ Understand what possible interactions may occur
ƒ Use or develop tools to detect referencing errors
Carnegie Mellon

Great Reality #4: There’s more to 
performance than asymptotic complexity

„ Constant factors matter too!
„ And even exact op count does not predict performance
ƒ Easily see 10:1 performance range depending on how code written
ƒ Must optimize at multiple levels: algorithm, data representations, 
procedures, and loops
„ Must understand system to optimize performance
ƒ How programs compiled and executed
ƒ How to measure program performance and identify bottlenecks
ƒ How to improve performance without destroying code modularity 
and generality
Carnegie Mellon

Memory System Performance Example
void copyij(int src[2048][2048], void copyji(int src[2048][2048],
int dst[2048][2048]) int dst[2048][2048])
{ {
int i,j; int i,j;
for (i = 0; i < 2048; i++) for (j = 0; j < 2048; j++)
for (j = 0; j < 2048; j++) for (i = 0; i < 2048; i++)
dst[i][j] = src[i][j]; dst[i][j] = src[i][j];
} }

21 times slower
(Pentium 4)

„ Hierarchical memory organization (caches)
„ Performance depends on access patterns
ƒ Including how step through multi‐dimensional array
Carnegie Mellon

Great Reality #5: 
Computers do more than execute programs
„ They need to get data in and out
ƒ I/O system critical to program reliability and performance

„ They communicate with each other over networks
ƒ Many system‐level issues arise in presence of network
ƒ Concurrent operations by autonomous processes
ƒ Coping with unreliable media
ƒ Cross platform compatibility
ƒ Complex performance issues
Carnegie Mellon

Overview
„ Course role and theme
„ Five realities
„ Logistics
Carnegie Mellon

Teaching staff
„ Instructors
ƒ Prof. Roger Dannenberg We’re glad to talk with you, but 
ƒ Prof. Greg Ganger please send email first or come to 
office hours.
„ TA’s
ƒ Ben Blum
ƒ Tessa Eng
ƒ Jonathan Harbuck
ƒ Teddy Martin
ƒ Hunter Pitelka
ƒ Josh Primera
ƒ Sean Stangl
ƒ Tom Tuttle
„ Course Admin
ƒ Bara Ammoura (“ECE Course Hub”, Hamerschlag Hall, D‐level, cube A‐10)
Carnegie Mellon

Textbooks
„ Randal E. Bryant and David R. O’Hallaron, 
ƒ “Computer Systems: A Programmer’s Perspective”, Prentice Hall 2003.
ƒ http://csapp.cs.cmu.edu
ƒ This book really matters for the course!
ƒ How to solve labs
ƒ Practice problems typical of exam problems

„ Brian Kernighan and Dennis Ritchie, 
ƒ “The C Programming Language, Second Edition”, Prentice Hall, 1988
Carnegie Mellon

Course Components
„ Lectures
ƒ Higher level concepts
„ Recitations
ƒ Applied concepts, important tools and skills for labs, clarification of 
lectures, exam coverage
„ Labs (6)
ƒ The heart of the course
ƒ 2 or 3 weeks
ƒ Provide in‐depth understanding of an aspect of systems
ƒ Programming and measurement
„ Exams (2 + final)
ƒ Test your understanding of concepts & mathematical principles
Carnegie Mellon

Getting Help
„ Class Web Page
ƒ http://www.cs.cmu.edu/~213
ƒ Copies of lectures, assignments, exams, solutions
ƒ Clarifications to assignments

„ Message Board
ƒ http://autolab.cs.cmu.edu
ƒ Clarifications to assignments, general discussion 
ƒ The only board your instructors will be monitoring (No blackboard or 
Andrew)
Carnegie Mellon

Getting Help
„ Staff mailing list
ƒ 15‐213‐[email protected] 
ƒ “The autolab server is down!”
ƒ “Who should I talk to about ...”
ƒ “This code {...}, which I don't want to post to the bboard, causes my 
computer to melt into slag.”
„ Teaching assistants
ƒ I don't get “associativity”...
ƒ Office hours, e‐mail, by appointment
ƒ Please send mail to 15‐213‐staff, not a randomly‐selected TA
„ Professors
ƒ Office hours or appointment
ƒ “Should I drop the class?” “A TA said ... but ...”
Carnegie Mellon

Policies: Assignments (Labs) And Exams
„ Work groups
ƒ You must work alone on all but final lab (see Syllabus!)
„ Handins
ƒ Assignments due at 11:59pm on Tues or Thurs evening
ƒ Electronic handins using Autolab (no exceptions!).
„ Conflict exams, other irreducible conflicts
ƒ OK, but must make PRIOR arrangements with Prof. Dannenberg/Ganger
„ Appealing grades
ƒ Within 7 days of completion of grading.
ƒ Following procedure described in syllabus
Carnegie Mellon

Autolab Web Service
„ Labs are provided by the Autolab system
ƒ Autograding handin system developed in 2003 by Dave O’Hallaron
ƒ Apache Web server + Perl CGI programs
ƒ Beta tested Fall 2003, very stable by now
„ With Autolab you can use your Web browser to:
ƒ Review lab notes, clarifications
ƒ Download the lab materials
ƒ Stream autoresults to a class status Web page as you work.
ƒ Handin your code for autograding by the Autolab server.
ƒ View the complete history of your code handins, autoresult
submissions, autograding reports, and instructor evaluations.
ƒ View the class status page
Carnegie Mellon

Facilities
„ Labs will use the Intel Computer Systems Cluster 
(aka “the fish machines”)
ƒ 15 Pentium Xeon servers donated by Intel for CS 213
ƒ Dual 3.2 Ghz 64‐bit (EM64T) Nocona Xeon processors
ƒ 2 GB, 400 MHz DDR2 SDRAM memory 
ƒ Rack mounted in the 3rd floor Wean Hall machine room.
ƒ Your accounts are ready nearing readiness.

„ Getting help with the cluster machines:
ƒ See course Web page for login directions
ƒ Please direct questions to your TA’s first
Carnegie Mellon

Timeliness
„ Grace days
ƒ 4 for the course
ƒ Covers scheduling crunch, out‐of‐town trips, illnesses, minor setbacks
ƒ Save them until late in the term!
„ Lateness penalties
ƒ Once grace days used up, get penalized 15%/day
ƒ Typically shut off all handins 2—3 days after due date
„ Catastrophic events
ƒ Major illness, death in family, …
ƒ Work with your academic advisor to formulate plan for getting back on 
track
„ Advice
ƒ Once you start running late, it’s really hard to catch up
Carnegie Mellon

Cheating
„ What is cheating?  (see Syllabus!)
ƒ Sharing code: either by copying, retyping, looking at, or supplying a 
copy of a file
ƒ Coaching: helping your friend to write a lab, line by line
ƒ Copying code from previous course or from elsewhere on WWW
ƒ Only allowed to use code we supply, or from CS:APP website
„ What is NOT cheating?
ƒ Explaining how to use systems or tools
ƒ Helping others with high‐level design issues
„ Penalty for cheating:
ƒ Removal from course with failing grade
„ Detection of cheating:
ƒ We do check and our tools for doing this are much better than you 
think!
Carnegie Mellon

Policies: Grading
„ Exams: weighted ¼, ¼, ½ (final)
„ Labs: weighted according to effort (determined near the end)

„ The worse of lab score and exam score is weighted 60%, the 
better 40%:
ƒ Lab score: 0 ≤ L ≤ 100, 
Exam score: 0 ≤ E ≤ 100
Total score: 0.6 min(L, E) + 0.4 max(L,E)

„ Guaranteed:
ƒ > 90%: A
ƒ > 80%: B
ƒ > 70%: C
Carnegie Mellon

Have Fun!

You might also like