UNCG-CSC100-F17-LECT4-ComputingAndProgramming
UNCG-CSC100-F17-LECT4-ComputingAndProgramming
and
Programming
Labs:
● Review solution for Lab 2 if you didn’t understand everything
○ Video solution walk-through in Canvas
○ Lab 3 builds on Lab 2, so make sure you understand Lab 2!
Question to Start the Day...
Context: Computation takes place as a sequence of steps
(can consider a 2 GHz computer to be taking 2 billion steps
per second).
Things to know:
● Data transferred around on wires (dark black
arrows in diagram) - fixed number of wires
limits how big (# digits) a number can be
● “ALU” is “Arithmetic Logic Unit” - this actually
does the computations: two inputs, one
output
So in general:
A step is an operation on two values from a
limited range of numbers.
Can’t operate on big numbers or more than two Diagram from Wikimedia Commons
things in a single step.
How Fast Can People Compute One Step?
132831 942
+476884 x837
412856
-304158
The Answers
132831 942
+476884 x837
609715 788454
412856
-304158
108698
How Fast?
If t is the fastest time, then t/3 seconds per calculation (or 3/t
calculations per second)
See http://www.top500.org/
Numbers in [brackets] are positions - use to refer to values (example: value [4])
Google Blockly lets you look at the same program in different languages:
See https://blockly-demo.appspot.com/static/demos/code/index.html#p7cnbv
Some Quotes
These are by Alan Perlis (1922-1990): An early computer scientist and
first winner of the Turing Award in 1966.
“A programming language is low level when its programs require attention
to the irrelevant.”
“A language that doesn't affect the way you think about programming, is
not worth knowing.”
“There will always be things we wish to say in our programs that in all
known languages can only be said poorly.”