Difference between revisions of "CSC103: DT's Notes 1"

From dftwiki3
Jump to: navigation, search
 
(40 intermediate revisions by the same user not shown)
Line 1: Line 1:
--&copy; [[User:Thiebaut|D. Thiebaut]] 08:10, 30 January 2012 (EST)<br />
+
--&copy; [[User:Thiebaut|D. Thiebaut]] 2012, 2013, 2014 <br />
 
Last revised --[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 08:05, 9 October 2013 (EDT)
 
Last revised --[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 08:05, 9 October 2013 (EDT)
 
----
 
----
 
__TOC__
 
__TOC__
 +
 +
<br />
 +
<center>[[CSC103 Notes, Newer Version| '''Newer Version, 2014''']]</center>
 +
<br />
  
  
<onlysmith>
 
  
 
=CSC103 How Computers Work--Class Notes=
 
=CSC103 How Computers Work--Class Notes=
  
 +
<onlysmith>
 
{| style="width:100%; background:#FFC340"
 
{| style="width:100%; background:#FFC340"
 
|-
 
|-
Line 23: Line 27:
 
===Current Computer Design is the Result of an Evolutionary Process===
 
===Current Computer Design is the Result of an Evolutionary Process===
 
|}
 
|}
<br />
+
<center>[[File:SteamBoyDT.png|700px]] </center><br />In this course we are going to look at the computer as a tool, as the result of technological experiments that have crystalized currently on a particular design, the von Neumann architecture, on a particular source of energy, electricity, on a particular fabrication technology, silicon transistors, and a particular information representation, the binary system, but any of these could have been different, depending on many factors.  In fact, in the next ten or twenty years, one of more of these fundamental parts that make today's computers could change.
 
 
[[Image:SteamboyTheMovie.png|right|200px]] In this course we are going to look at the computer as a tool, as the result of technological experiments that have crystalized currently on a particular design, the von Neumann architecture, on a particular source of energy, electricity, on a particular fabrication technology, silicon transistors, and a particular information representation, the binary system, but any of these could have been different, depending on many factors.  In fact, in the next ten or twenty years, one of more of these fundamental parts that make today's computers could change.
 
  
 
[http://www.imdb.com/title/tt0348121/ '''Steamboy'''], a Japanese anim&eacute; by director Katsuhiro Ohtomo (who also directed ''Akira'') is interesting in more than the story of a little boy who is searching for his father, a scientist who has discovered a secret method for controlling high pressured steam.  What is interesting is that the movie is science fiction taking place not in the future, but in middle of the 19th century, in a world where steam progress and steam machines are much more advanced than they actually were at that time.  One can imagine that some events, and some discoveries where made in the world portrayed in the animated film, and that technology evolved in quite a different direction, bringing with it new machines, either steam-controlled tank-like vehicles, or ships, or flying machines.
 
[http://www.imdb.com/title/tt0348121/ '''Steamboy'''], a Japanese anim&eacute; by director Katsuhiro Ohtomo (who also directed ''Akira'') is interesting in more than the story of a little boy who is searching for his father, a scientist who has discovered a secret method for controlling high pressured steam.  What is interesting is that the movie is science fiction taking place not in the future, but in middle of the 19th century, in a world where steam progress and steam machines are much more advanced than they actually were at that time.  One can imagine that some events, and some discoveries where made in the world portrayed in the animated film, and that technology evolved in quite a different direction, bringing with it new machines, either steam-controlled tank-like vehicles, or ships, or flying machines.
Line 32: Line 34:
 
One can argue that if von Neumann hadn't written this report, we may have followed somebody else's brilliant idea for putting together a machine working with electricity, where information is stored and operated on in binary form.  Our laptop today could be using a different architecture, and programming them might be a totally different type of problem solving.
 
One can argue that if von Neumann hadn't written this report, we may have followed somebody else's brilliant idea for putting together a machine working with electricity, where information is stored and operated on in binary form.  Our laptop today could be using a different architecture, and programming them might be a totally different type of problem solving.
  
[[Image:Antikythera.jpg|right|200px]]For computers were not always electrical machines.  Initially they were mechanical machines.  The abacus, which appeared several millennia B.C. was a counting machine made of wood.  The [http://en.wikipedia.org/wiki/Antikythera_mechanism Antikythera] mechanism, is currently regarded as the first mechanical machine for computing astronomical calculations.  Mechanical as well, the important machine in the history of computers is '''[http://en.wikipedia.org/wiki/Difference_engine Babbage's Difference Engine]'''.  This one was made of gears and shafts, with a crank at the top, and was a ''general purpose'' machine.  Interestingly, this machine has given us an expression we still use with modern electronic computers:  we still hear programmers refer to  "cranking out" the results, even though the crank is long gone.
+
[[File:AntikytheraMecanism.png|right|thumb|400px| Antikythera Mechanism, photo taken by Tilemahos Efthimiadis, National Archaeological Museum, Athens, Greece., taken from commons.wikimedia.org, July 28 2014. Released under the Creative Commons Attribution 2.0 Generic license.]] For computers were not always electrical machines.  Initially they were mechanical machines.  The abacus, which appeared several millennia B.C. was a counting machine made of wood.  The [http://en.wikipedia.org/wiki/Antikythera_mechanism Antikythera] mechanism, is currently regarded as the first mechanical machine for computing astronomical calculations.  Mechanical as well, the important machine in the history of computers is '''[http://en.wikipedia.org/wiki/Difference_engine Babbage's Difference Engine]'''.  This one was made of gears and shafts, with a crank at the top, and was a ''general purpose'' machine.  Interestingly, this machine has given us an expression we still use with modern electronic computers:  we still hear programmers refer to  "cranking out" the results, even though the crank is long gone.
  
 
The same is true of '''silicon transistors''' powered by electricity.  Silicon is the material of choice for electronic microprocessor circuits as well as semiconductor circuits we find in today's computers.  Its appeal lies in its property of being able to either conduct and not conduct electricity, depending on a signal it receives which is also electrical.  Silicon allows us to create electrical switches that are very fast, very small, and consume very little power.  But because we are very good at creating semiconductor  
 
The same is true of '''silicon transistors''' powered by electricity.  Silicon is the material of choice for electronic microprocessor circuits as well as semiconductor circuits we find in today's computers.  Its appeal lies in its property of being able to either conduct and not conduct electricity, depending on a signal it receives which is also electrical.  Silicon allows us to create electrical switches that are very fast, very small, and consume very little power.  But because we are very good at creating semiconductor  
Line 56: Line 58:
 
|-
 
|-
 
|
 
|
 +
 
===Binary System===
 
===Binary System===
 
|}
 
|}
Line 526: Line 529:
 
</tanbox>
 
</tanbox>
 
<br />
 
<br />
[[Image:IceCreamContainer.jpg|right|200px]]
+
[[File:IceCreamCup3Balls.png|thumb|right|400px|D. Thiebaut, Ice Cream, 2014, Released under the Creative Commons Attribution 2.0 Generic license.]]
 
We can devise three boolean variables that can be true of false depending on three properties of a container of ice cream: ''choc'', ''fruit'', and ''HG''.  ''choc'' is true if the ice cream contains some chocolate.  ''fruit'' is true if the ice cream contains fruits, and ''HG'' is true if the ice cream is from Haagen Dazs.  A boolean function, or expression, we're going to call it ''isgood'', containing ''choc'', ''fruit'', and ''HG'' that turns true whenever the ice cream is one our friend will like would be this:
 
We can devise three boolean variables that can be true of false depending on three properties of a container of ice cream: ''choc'', ''fruit'', and ''HG''.  ''choc'' is true if the ice cream contains some chocolate.  ''fruit'' is true if the ice cream contains fruits, and ''HG'' is true if the ice cream is from Haagen Dazs.  A boolean function, or expression, we're going to call it ''isgood'', containing ''choc'', ''fruit'', and ''HG'' that turns true whenever the ice cream is one our friend will like would be this:
  
Line 619: Line 622:
 
|-
 
|-
 
|
 
|
 +
 
===Shannon's MIT Master's Thesis: the missing link===
 
===Shannon's MIT Master's Thesis: the missing link===
 
|}
 
|}
Line 632: Line 636:
  
 
<br />
 
<br />
<center>[[Image:CSC103ElectricalAndOrCircuits.png|500px]]</center>
+
<center>[[File:ANDORGatesWithSwitches.png|500px|thumb|AND OR gates with switches. D. Thiebaut, 2014, Released under the Creative Commons Attribution 2.0 Generic license.]]</center>
  
 
<br />
 
<br />
Line 781: Line 785:
 
|-
 
|-
 
|
 
|
 +
 
===Discoveries===
 
===Discoveries===
 
|}
 
|}
Line 807: Line 812:
  
 
<br />
 
<br />
<center>[[Image:LogicGatesAndOrNot.png ]]</center>
+
<center>[[Image:LogicGatesAndOrNot.png|thumb|300px|Inverter, And, and Or gates. D. Thiebaut, 2014, Released under the Creative Commons Attribution 2.0 Generic license. ]]</center>
  
 
<br />
 
<br />
Line 891: Line 896:
  
 
<br />
 
<br />
<center>[[Image:IntegratedCircuit.png]]&nbsp;[[Image:7408PinOut.png]]</center>
+
<center>[[File:ICAndGate.jpg|thumb|600px|Integrated Circuit, AND gate. D. Thiebaut, 2014, Released under the Creative Commons Attribution 2.0 Generic license.]]</center>
 
<br />
 
<br />
  
 
The image on the left, above, shows an ''integrated circuit'' (IC)close up.  In reality the circuit is about as long as a quarter (and with newer technology even smaller).  The image on the right shows what is inside the IC.  Just 4 AND gates.  There are other ICs that contain different types of gates, such as OR gates or Inverters.
 
The image on the left, above, shows an ''integrated circuit'' (IC)close up.  In reality the circuit is about as long as a quarter (and with newer technology even smaller).  The image on the right shows what is inside the IC.  Just 4 AND gates.  There are other ICs that contain different types of gates, such as OR gates or Inverters.
 +
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
 +
<br />
  
 
==Building a Two-Bit Adder with Logic Gates==
 
==Building a Two-Bit Adder with Logic Gates==
Line 906: Line 925:
 
To implement it with logic gates we make ''a'' and ''b'' inputs, and ''f'' the output of the circuit.  Then ''b'' is fed into an inverter gate (NOT), and the output of the inverter into the input of an AND gate.  The other input of the AND gate is connected to the ''a'' signal, and the output becomes ''f''.
 
To implement it with logic gates we make ''a'' and ''b'' inputs, and ''f'' the output of the circuit.  Then ''b'' is fed into an inverter gate (NOT), and the output of the inverter into the input of an AND gate.  The other input of the AND gate is connected to the ''a'' signal, and the output becomes ''f''.
 
<br />
 
<br />
<center>[[Image:aANDNOTb.png]]</center>
+
<center>[[Image:aANDNOTb.png|frame|A and Not B, D. Thiebaut, 2014, Released under the Creative Commons Attribution 2.0 Generic license.]]</center>
  
 
<br />
 
<br />
Line 912: Line 931:
  
 
<br />
 
<br />
<center>[[Image:2BitAdderWithGates.png|350px]]</center>
+
<center>[[Image:2-bitAdderGates.png|frame|350px|2-Bit Adder, D. Thiebaut, 2014, Released under the Creative Commons Attribution 2.0 Generic license.]]</center>
 
<br />
 
<br />
 
<br />
 
<br />
Line 949: Line 968:
 
|-
 
|-
 
|
 
|
 +
 
=Computer Simulator=
 
=Computer Simulator=
 
|}
 
|}
Line 960: Line 980:
 
Let's assume that we want to play a very simple game based on ''coding''.  The game is quite easy to get: we want two people to have a conversation where each word or sentence that they can say is limited to a small set of preselected sentence, and each one is associated with a number.  When the two people talk to each other, they must pick the number corresponding to the sentence, question, or answer they want to say.
 
Let's assume that we want to play a very simple game based on ''coding''.  The game is quite easy to get: we want two people to have a conversation where each word or sentence that they can say is limited to a small set of preselected sentence, and each one is associated with a number.  When the two people talk to each other, they must pick the number corresponding to the sentence, question, or answer they want to say.
  
[[Image:CSC103 Conversation 2.jpg|200px|right]]
+
[[File:Conversation.jpg|thumb|500px|right|Daniel Coy, "Conversation", online image, https://flic.kr/p/7mWZpb, Captured July 2014.]]
  
 
Here's a list of numbers and their associated sentences:
 
Here's a list of numbers and their associated sentences:
Line 1,055: Line 1,075:
 
|-
 
|-
 
|
 
|
 +
 
===Computer Memory===
 
===Computer Memory===
 
|}
 
|}
Line 1,064: Line 1,085:
  
 
<br />
 
<br />
<center>[[Image:CSC103FlipFlop1.jpg|600px]]</center>
+
<center>[[File:NandFlipFlop1.png|thumb|600px|Nand Flipflop 1, D. Thiebaut, 2014, Released under the Creative Commons Attribution 2.0 Generic license.]]</center>
 
<br />
 
<br />
 
You may want to spend the time building it up with our [http://tinyurl.com/103applets| circuit simulator].  
 
You may want to spend the time building it up with our [http://tinyurl.com/103applets| circuit simulator].  
Line 1,073: Line 1,094:
  
 
<br />
 
<br />
<center>[[Image:CSC103FlipFlop2.jpg|600px]]</center>
+
<center>[[File:NandFlipFlop2.png|thumb|600px|Nand Flipflop 2, D. Thiebaut, 2014, Released under the Creative Commons Attribution 2.0 Generic license.]]</center>
 
<br />
 
<br />
  
Line 1,081: Line 1,102:
 
with similar circuits.
 
with similar circuits.
  
<br /><center>[[Image:animatedScale.gif]]</center>
+
<br /><center>[[File:Scale.gif|frame|Animated Scale, D. Thiebaut, 2014, Released under the Creative Commons Attribution 2.0 Generic license.]]</center>
 
<br />
 
<br />
  
Line 1,129: Line 1,150:
 
|-
 
|-
 
|
 
|
 +
 
===The Processor===
 
===The Processor===
 
|}
 
|}
Line 1,139: Line 1,161:
 
</bluebox>
 
</bluebox>
 
<br />
 
<br />
[[Image:Calculator.jpg|right|150px]]
+
[[Image:Calculator.png|right|thumb|300px|Ilnanny, "Calculator", online image, openclipart.org/image/800px/svg_to_png/170371/1338745223.png, captured Aug. 1st, 2014.]]
 
The processor has three important registers that allow it to work in this machine-like fashion: the '''PC''', the '''Accumulator''' (shortened to '''AC'''), and the '''Instruction Register''' ('''IR''' for short).  The PC is used to "point" to the address in memory of the next word to bring in.  When this number enters the processor, it must be stored somewhere so that the processor can figure out what kind of action to take.  This holding place is the '''IR''' register.  The way the '''AC''' register works is best illustrated by the way we use a regular hand calculator.  Whenever you enter a number into a calculator, it appears in the display of the calculator, indicating that the calculator actually holds this value somewhere internally.  When you type a new number that you want to add to the first one, the first number disappears from the display, but you know it is kept inside because as soon as you press the = key the sum of the first and of the second number appears in the display.  It means that while the calculator was displaying the second number you had typed, it still had the first number stored somewhere internally.  For the processor there is a similar register used to keep intermediate results.  That's the '''AC''' register.
 
The processor has three important registers that allow it to work in this machine-like fashion: the '''PC''', the '''Accumulator''' (shortened to '''AC'''), and the '''Instruction Register''' ('''IR''' for short).  The PC is used to "point" to the address in memory of the next word to bring in.  When this number enters the processor, it must be stored somewhere so that the processor can figure out what kind of action to take.  This holding place is the '''IR''' register.  The way the '''AC''' register works is best illustrated by the way we use a regular hand calculator.  Whenever you enter a number into a calculator, it appears in the display of the calculator, indicating that the calculator actually holds this value somewhere internally.  When you type a new number that you want to add to the first one, the first number disappears from the display, but you know it is kept inside because as soon as you press the = key the sum of the first and of the second number appears in the display.  It means that while the calculator was displaying the second number you had typed, it still had the first number stored somewhere internally.  For the processor there is a similar register used to keep intermediate results.  That's the '''AC''' register.
 
<br />
 
<br />
[[Image:CSC103MotherBoard.jpg|250px | right]]
+
[[File:PrintedCircuitBoard.jpg|250px|thumb|Barney Livingston, "BBC B - PCB, CPU removed," online image, farm1.staticflickr.com/83/235291503_080d9656a8_o_d.jpg, captured Aug. 1st, 2014.]]
 
<br />
 
<br />
 
All the processor gets from these memory cells it reads are ''numbers''.  Remember, that's the only thing we can actually create in a computer: groups of bits.  So each memory cell's number is read by the processor.  How does the number move from memory to the processor?  The answer: on metal wires, each wire transferring one bit of the number.  If you have ever taken a computer apart and taken a look at its ''motherboard'', you will have seen such wires.  They are there for bits to travel back and forth between the different parts of the computer, and in particular between the processor and the memory.  The image to the right shows the wires carrying the bits (photo courtesy of [http://www.inkity.com/catalog/product/2/11195/Motherboard-Detail.html www.inkity.com]).  Even though it seems that some wires do not go anywhere, they actually connect to tiny holes that go through the motherboard and allow them to continue on the other side, allowing wires to cross each other without touching.).
 
All the processor gets from these memory cells it reads are ''numbers''.  Remember, that's the only thing we can actually create in a computer: groups of bits.  So each memory cell's number is read by the processor.  How does the number move from memory to the processor?  The answer: on metal wires, each wire transferring one bit of the number.  If you have ever taken a computer apart and taken a look at its ''motherboard'', you will have seen such wires.  They are there for bits to travel back and forth between the different parts of the computer, and in particular between the processor and the memory.  The image to the right shows the wires carrying the bits (photo courtesy of [http://www.inkity.com/catalog/product/2/11195/Motherboard-Detail.html www.inkity.com]).  Even though it seems that some wires do not go anywhere, they actually connect to tiny holes that go through the motherboard and allow them to continue on the other side, allowing wires to cross each other without touching.).
Line 1,164: Line 1,186:
 
|-
 
|-
 
|
 
|
 +
 
===The Cookie Monster Analogy===
 
===The Cookie Monster Analogy===
 
|}
 
|}
[[File:CookieMonsterPacMan.png|right|150px]]
+
[[File:CookieMonsterPacMan.png|right|thumb|350px|Cookie Monster, D. Thiebaut, 2014, Released under the Creative Commons Attribution 2.0 Generic license.]]
 
The processor is just like the cookie monster.  But a cookie monster acting like Pac-Man, a Pac-Man that follows  
 
The processor is just like the cookie monster.  But a cookie monster acting like Pac-Man, a Pac-Man that follows  
 
a straight path made of big slabs of cement, where there's a cookie on each slab.  Our Cookie-Monster-Pac-Man  
 
a straight path made of big slabs of cement, where there's a cookie on each slab.  Our Cookie-Monster-Pac-Man  
Line 1,195: Line 1,218:
 
|-
 
|-
 
|
 
|
 +
 
===Instructions and Assembly Language===
 
===Instructions and Assembly Language===
 
|}
 
|}
Line 1,726: Line 1,750:
 
====Moore's Law====
 
====Moore's Law====
 
<br />
 
<br />
[[Image:GordonMoore.jpg|right]]
+
[[Image:GordonMooreCC2.png|right|300px]]
  
 
Gordon E. Moore, the co-founder of Intel, is credited with the observation that the number of transistors in integrated circuits had doubled every 18 months since 1958 to 1965<ref name="moore1965">Gordon E. Moore, Cramming More Components onto
 
Gordon E. Moore, the co-founder of Intel, is credited with the observation that the number of transistors in integrated circuits had doubled every 18 months since 1958 to 1965<ref name="moore1965">Gordon E. Moore, Cramming More Components onto
Line 1,990: Line 2,014:
 
====Variation #1====
 
====Variation #1====
 
|}
 
|}
[[Image:QuestionMark2.jpg|right|100px]]
+
[[Image:DTQuestionMark2.jpg|right|200px]]
  
 
* Locate the '''rect()''' graphics function in Processing's [http://processing.org/reference/rect_.html reference] section.
 
* Locate the '''rect()''' graphics function in Processing's [http://processing.org/reference/rect_.html reference] section.
Line 2,023: Line 2,047:
 
====Variation #2====
 
====Variation #2====
 
|}
 
|}
[[Image:QuestionMark1.jpg|right|100px]]
+
[[Image:DTQuestionMark1.jpg|right|200px]]
 
<br />
 
<br />
 
* Locate the '''background()''' graphics function in Processing's [http://processing.org/reference/rect_.html reference] section.
 
* Locate the '''background()''' graphics function in Processing's [http://processing.org/reference/rect_.html reference] section.
Line 2,056: Line 2,080:
 
====Variation #3====
 
====Variation #3====
 
|}
 
|}
[[Image:QuestionMark3.jpg|right|100px]]
+
[[Image:DTQuestionMark3.jpg|right|200px]]
 
<br />
 
<br />
 
* Let's fill the ellipse with a color.  This is accomplish with the '''fill()''' function.
 
* Let's fill the ellipse with a color.  This is accomplish with the '''fill()''' function.
Line 2,149: Line 2,173:
 
|}
 
|}
 
<references />
 
<references />
 +
<br />
 
</onlysmith>
 
</onlysmith>
 
<br />
 
 
<br />
 
<br />
 
<br />
 
<br />

Latest revision as of 15:24, 7 September 2017

--© D. Thiebaut 2012, 2013, 2014
Last revised --D. Thiebaut (talk) 08:05, 9 October 2013 (EDT)



Newer Version, 2014



CSC103 How Computers Work--Class Notes


This section is only visible to computers located at Smith College












.