Computer Systems: A Programmer's Perspective - Course Syllabus, Lecture notes of Network Technologies and TCP/IP

The first lecture of the course Introduction to Computer Systems at Carnegie Mellon University. The course aims to teach students how to be more effective programmers by understanding the underlying system. The lecture covers the course overview, course perspective, and five realities of computer systems. The lecture also emphasizes the importance of understanding the details of underlying implementations and memory referencing bugs. examples of memory referencing bugs and memory system performance.

Typology: Lecture notes

Pre 2010

Uploaded on 05/11/2023

nicoline
nicoline 🇺🇸

4.6

(12)

271 documents

1 / 29

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Carnegie Mellon
IntroductiontoComputerSystems
15213/18243,Spring2009
1st Lecture,Aug.25th
Instructors:
RogerDannenbergandGregGanger
ThecoursethatgivesCMUits“Zip”!
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d

Partial preview of the text

Download Computer Systems: A Programmer's Perspective - Course Syllabus and more Lecture notes Network Technologies and TCP/IP in PDF only on Docsity!

Introduction

to^ Computer

Systems

Spring^2009 st^1 Lecture,^

thAug. 25 Instructors: Roger^ Dannenberg

and^ Greg^ Ganger

The^ course

that^ gives

CMU^ its

“Zip”!

Overview^ „^ Course

role^ and^ theme

„^ Five^ realities „^ Logistics

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

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

Great^ Reality

Int’s are

not^ Integers,

Float’s

are^ not

Reals

„^ Example

2 1: Is x ≥^ 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:^ ƒ^ (1e

+^ ‐1e20)^ +^ 3.

‐‐>^ 3.

ƒ^ 1e20^ +^ (‐

1e20^ +^ 3.14)

‐‐>^ ??

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

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

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. fun(1)^ –>

3. fun(2)^ –>

3. fun(3)^ –>

2. fun(4)^ –>

3.14, then segmentation fault

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

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

Great^ Reality

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

Overview^ „^ Course

role^ and^ theme

„^ Five^ realities „^ Logistics

Textbooks^ „^ Randal

E.^ Bryant

and^ David

R.^ O’Hallaron,

ƒ^ “Computer

Systems:^ A^

Programmer’s

Perspective”,

Prentice^ Hall

ƒ^ 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

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