Slides PDF

Transcription

Slides PDF
Computer Systems
CS107
Cynthia Lee
2
Today’s Topics
1.
2.
3.
4.
INTRODUCTIONS
W HAT IS THIS CLASS?
COURSE COMPONENTS AND POLICIES OVERVIEW
DIVING RIGHT INTO THE CONTENT:
›
Your first C program, your first command-line compilation
NEXT LECTURE:
› More whirlwind tour of C and UNIX
Cynthia Lee
Introductions
WELCOME TO CS107!
[email protected]
 Quick poll: how many of you have been in a class with me before?
TAs
WE HAVE SEVERAL OUTSTANDING TAS TO HELP YOU THIS QUARTER
 Chung Yu Wang
 Duyun Chen
 James Tran
 Keziah Sonder Plattner
 Laura Groenendaal
 Matt Anderson
 Patrick Harvey
 Shahriyar Pruisken
 Shantanu Joshi
 Sumi Narayanan
What is CS107 all about?
WHAT HAVE YOU HEARD?
DISCUSS 2 MIN: (1) SOMETHING YOU’VE HEARD ABOUT
CS107 THAT EXCITES YOU, (2) SOMETHING YOU’VE HEARD
ABOUT CS107 THAT SEEMS OMINOUS.
What is CS107 all about?
HAVE YOU EVER NOTICED HOW “HACKER” WORK LOOKS IN
OLD MOVIES?...
Independence Day (1996)
(JEFF GOLDBLUM’S CHARACTER SAVING THE WORLD BY UPLOADING A VIRUS TO
THE ALIEN MOTHERSHIP)
(SO THIS GUY CAN GO DIVEBOMB IT)
Matrix Reloaded (2003)
(TRINITY SAVING THE WORLD BY HACKING INTO THE POWER GRID)
The Girl with the Dragon Tattoo (2011)
(LISBETH SALANDER RESEARCHING MURDERS)
TRON Legacy (2011)
http://youtu.be/VO5qq1XN64M?t=2m51s
What is CS107 about?
 The CS106 series teaches you how to solve problems as a programmer
 Many times we had to say “just don’t worry about that” or “it probably
doesn’t make sense why that happens, but ignore it for now” or “just type
this to fix it”
 CS107 finally takes you “behind the scenes”
 How do things really work in there?
› It’s not hardware or physics/electromagnetism (those will have to stay
even further behind the scenes for now!)
› It’s how things work inside Java/C++ (we will explore from C), and
how your programs map onto the components of computer systems
Here’s one reason why I think you should be excited:
 Who doesn’t love the idea of having an exclusive backstage pass?
 Who doesn’t love being in on a secret?
 It just feels good to know!
 Did any of you watch How It’s Made or the crayon factory segment on
Sesame Street and Mr. Roger’s Neighborhood? So fun! See how
everyday things are made!
Here’s another reason why I think you should be excited:
 This stuff MATTERS!
 Here’s a figure that appears
twice in your book (it’s that
important!)
 It takes one cycle to access
data in L0 (registers)
 It takes ~107-108 cycles to
access data in L5 (disk)
What are the learning goals for the course?
 The goals for CS107 are for students to gain mastery of
› writing C programs with complex use of memory and pointers
› an accurate model of the address space and compile/runtime behavior
of C programs
 to achieve competence in
› translating C to/from assembly
› writing programs that respect the limitations of computer arithmetic
› identifying bottlenecks and improving runtime performance
› writing code that correctly ports to other architectures
› working effectively in unix development environment
 and have exposure to
› a working understanding of the basics of computer architecture
More on the learning goals for the course
 Many systems courses take the approach of building something
› Write a compiler
› Make a robot
› Write a simple OS
› This is a very useful approach, and you’ll take courses later on that do
some of these things
 However, this course takes a different approach
› Keep very much a programmer’s perspective on systems
• What does a programmer need to know to work effectively?
• What does a programmer need to know to write efficient code?
› In a sense, we are concerned with building YOU
• The CS107 alum rocks at writing, managing, and debugging
programs that make complex use of memory and pointers
• The CS107 alum is not afraid of looking under the hood at compiler
and linker problems
• The CS107 alum can handle any interview question 
How does CS107 work?
HOW DO I GET AN A IN THIS CLASS?
Your grade
 60% homework
› 45% assignments (8)
› 15% weekly labs
 40% exams
› 15% midterm
› 25% final
Other grade notes
 Units:
› Undergraduates must take the course for 5 units.
› Graduate and professional students may take the course for 3 or 4
units, but this does not change course requirements.
 Final letter grades:
› Will be no stricter than 90% = A-, 80% = B-, 70% = C-, 60% = D-, but
I may curve more generously by a few percentage points if necessary
to adjust for exam difficulty.
› Please note that you need to earn a passing grade on the exams
and homework independently in order to pass the class,
regardless of total numeric grade at the end of the quarter.
Textbooks
 You’ll want to get the Bryant and O’Hallaron book
 The suggested C reference is just one suggestion, you could also get a
different C reference, or just rely on web resources
› Just need somewhere to turn when you have a question about C
Stanford Honor Code
THE HONOR CODE IS AN UNDERTAKING OF THE STUDENTS, INDIVIDUALLY AND
COLLECTIVELY:
› that they will not give or receive aid in examinations; that they will not give or
receive unpermitted aid in class work, in the preparation of reports, or in any other
work that is to be used by the instructor as the basis of grading;
› that they will do their share and take an active part in seeing to it that others as
well as themselves uphold the spirit and letter of the Honor Code.
The faculty on its part manifests its confidence in the honor of its students by
refraining from proctoring examinations and from taking unusual and
unreasonable precautions to prevent the forms of dishonesty mentioned above.
The faculty will also avoid, as far as practicable, academic procedures that create
temptations to violate the Honor Code.
While the faculty alone has the right and obligation to set academic requirements, the
students and faculty will work together to establish optimal conditions for
honorable academic work.
see also: http://honorcode.stanford.edu/
21
Getting started to-do list:
VISIT OUR CLASS WEBSITE AND ORIENT YOURSELF:

http://cs107.stanford.edu
PLAN TO ATTEND A UNIX HELP SESSION ON TUES, W ED, OR THURS
GET ON MYTH, GET YOURSELF SET UP WITH MERCURIAL (LIKE GITHUB), AND
START FEELING COMFORTABLE WITH THE PROGRAMMING ENVIRONMENT
CHECK OUT PIAZZA FORUM
READ THE ENTIRE COURSE INFO SHEET
Getting Started
UNIX, AND YOUR FIRST C PROGRAM
TRON Legacy (2011)
http://youtu.be/VO5qq1XN64M?t=2m51s
TRON Legacy (2011) (screenshot #2)
http://youtu.be/VO5qq1XN64M?t=2m51s
TRON
Legacy
(closeup)