Skip to content

Commit

Permalink
added lec02 notes; fixed types on lec01
Browse files Browse the repository at this point in the history
  • Loading branch information
psoberoi committed Apr 1, 2014
1 parent 3f1f95e commit e5b71ee
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 8 deletions.
16 changes: 8 additions & 8 deletions notes/lec01.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Is programming a discipline?
- clearly there is a discipline called "computer science"
- is it the same as programming?
- there are several great computer scientists who never wrote code
- and there are good programmers whp don't know computer science
- and there are good programmers who don't know computer science
- does Ken Thompson know type theory?
- does he follow research on complexity theory?
- common view: programming is not a discipline, just grunt work
Expand Down Expand Up @@ -46,9 +46,9 @@ Knuth
- then... TeX, Metafont
- and... Literate Programming (web)
- Stanford Graph Base
- No progrmaming language - MIX, MMIX
- No programming language - MIX, MMIX
- Need to know computer architecture
- Hennessey & Patterson, Computer Architecture
- Hennessy & Patterson, Computer Architecture
- After Knuth: belief that the computer must be hidden

Computer Science
Expand All @@ -74,13 +74,13 @@ Profession

ACM
- Used to be a professional organization for programmers
- Was highjacked by CS professors
- Was hijacked by CS professors
- Used to publish code
- ACM Collection of Algorithms
- was taken over by numerical analysts
- We need a professional organization
- with journals
- Programmers often descrive themselves as Artists - by which they mean they
- Programmers often describe themselves as Artists - by which they mean they
don't have to follow any rules. That is bad for the field, and bad for them.
We need t be professional and "boring" like lawyers

Expand All @@ -92,12 +92,12 @@ What is Programming?
- Write lots of code?
- for digital computers?
- to solve problems
- modelling reality?
- modeling reality?
- map problem into bits

BITS! - 0s and 1s
- great discovery
- Leibnitz
- Leibniz
- Turing
- real-world problem -> mathematics -> bits
- manipulate the bits with code
Expand All @@ -113,7 +113,7 @@ We must study real machines
- individual brilliant people can make mistakes
- but eventually bad architectures die out
- market dynamics
- intel reacts to customer demands
- Intel reacts to customer demands
- we we must take it seriously
- Late 90s - x86 is dead, long live itanium

Expand Down
133 changes: 133 additions & 0 deletions notes/lec02.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
Lecture 2

Last lecture: Programming is about bits

This was not always self evident
- bits were invisible for many years
- bytes for decades
- the abstract machine model took along time to emerge

Bits not self-evident
- it was clear that computers must operate on numbers
- but how should numbers be represented?
- Knuth, 1968 - support both binary and decimal
- many architectures supported BCD, including x86
- word sizes were not powers of two - all kinds
- cray: 60 bit words

Popular word sizes: 36 bits and 60 bits
- divisible by 6
- 6 bits enough to encode English characters
- but 6-bit "bytes" were not addressable
- IBM STRETCH: bit addressable

Mid-60s: IBM 360
- first architecture that spanned a family of machines
- great team of people
- c machine model a result of IBM 360
- byte addressable
- full-blown pointers
- IBM Principles of Operation
- Brooks and Blaauw

Revolutionary
- lots of clones
- copied widely internationally
- including in the USSR (allegedly aided by the CIA)
- slowly the "exotic" word sizes disappeared

However, no access to this low level abstract machine
- all serious programming done in assembly
- need access to bits
- performance

1953: John Backus: Formula Translation
- Wrote memo to mgmt, asked for large team (10 best people)
- Due diligence: mgmt asked von Neumann
- terrible idea
- why waste valuable computer time on this?
- just use "girls"
- IBM goes ahead anyway
- History very well documented by Paul McJones

FORTRAN compiler
- First
- They had to invent all the basic ideas
- "compiler", "basic block", "optimization", "frequency" hints
- conditional statement, do statement, arrays
- primitives derived from hardware instructions
- Goal: as fast as hand-written code
- took 4 years (released in 1957)
- very efficient code, right from the start
- very successful from the start - physicists embraced it

FORTRAN's success led to the notion of "portability"
- Initially only ran on IBM 704
- Other companies realized that the language was not machine specific
- They implemented their own implementations to attract physicists
- Physicists could freely move code from machine to machine
- They were in a state of bliss
- No other portable software for quite a while

But FORTRAN was widely maligned
- Computer scientists thought it was a horrible language
- Dijkstra, Hoare - wrote nasty things
- Physicists used it anyway, and still do
- It was, and remains, a great achievement

FORTRAN v/s Smalltalk style
- FORTRAN - arrays
- Smalltalk - lots of small objects, all alike
- Both styles possible in most languages
- with the resulting performance characteristics

FORTRAN supported both ints and floating point
- von Neumann - no need for floating point - any mathematician should be able to normalize the result in their head
- but very few mathematicians were like von Neumann
- hardware manufacturers supported floating point

Integer representation
- decimal or binary
- even after binary became common, how to represent sign
- ints were always signed
- Two's Complement
- Signed Magnitude
- One's Complement
- signed magnitude and 1's complement had two zeros
- many violent arguments about zeros
- integer semantics still not quite understood, even today
- integer sizes were different across machines, of course
- floating point eventually standardized
- Kahan
- no such luck for integers...

Languages
- FORTRAN -> II -> IV -> 77 -> 90 -> ...
- Algol 60
- Int, Float
- PL/1
- universal language
- systems programming needs, in a HLL
- large and unwieldy
- Multics, big failure
- but, led to Ken and Dennis
- some access to bits
- PL/S
- BLISS

C
- UNIX initial version: assembly
- not portable...
- BCPL, B, C
- Dennis was a genius
- C ugly, not easy to parse
- unlike Wirth languages (Pascal, Modula-2)
- But: came up with a machine model roughly matching IBM 360

Revolutionary
- At that time, designers were convinced that the job of the language was to hide the machine
- as late as ~1985, in a a Wirth/Knuth interview:
- Wirth: A pointer type should not have < defined on it
- obviously
- Knuth: So if you have a list of pointers to records, you cannot use binary search?

0 comments on commit e5b71ee

Please sign in to comment.