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

From dftwiki3
Jump to: navigation, search
Line 1,039: Line 1,039:
 
So now, even though this simple game is far from sophisticated or even fully functional, it should illustrate the principle that are at play when a processor executes a program that resides in memory.  We explore this in the next section.  By the way, if while reading the last ''algorithm'' shown above you thought to yourself "Hmmm... something strange is going to happen when we reach the last student in the class...", then you have a very logical mind, and Yes, indeed, you are right, our algorithm is not quite correct.  But it's enough to get our point across.
 
So now, even though this simple game is far from sophisticated or even fully functional, it should illustrate the principle that are at play when a processor executes a program that resides in memory.  We explore this in the next section.  By the way, if while reading the last ''algorithm'' shown above you thought to yourself "Hmmm... something strange is going to happen when we reach the last student in the class...", then you have a very logical mind, and Yes, indeed, you are right, our algorithm is not quite correct.  But it's enough to get our point across.
  
 +
<br />
 +
{| style="width:100%; background:#FFD373"
 +
|-
 +
|
 +
===Time for a Game of Numbers===
 +
|}
  
 
<br />
 
<br />
 +
We take a short break to play a simple game:
 +
that of having a conversation with each other, but only using numbers.  The first game is
 +
simple.  Just get a friend sitting in front of you and give her a copy of the numbers and words below.
 +
Then start by saying "zero one".  Very quickly your friend will figure out what is going on and respond
 +
"one three".  You may continue with "zero five, one one," and quickly you learn from each other using
 +
just numbers!
 +
 +
The second set of numbers is more sophisticated because you can create an algorithm with a loop, allowing
 +
you to have a conversation with many people, '''only using numbers'''!
 +
 +
 +
[[Image:CSC103 Conversation 2.jpg|200px|right]]
 +
 +
<br />
 +
First set of numbers to play the game "Let's talk!"
 +
 +
00&nbsp;&nbsp;Really?
 +
01&nbsp;&nbsp;Hello&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;00&nbsp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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;11&nbsp;&nbsp;Breakfast
 +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;12&nbsp;&nbsp;PC&nbsp;Lab
 +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;13&nbsp;&nbsp;Hello
 +
 +
What is important for us to gather from playing this game is that
 +
# numbers are sufficient to define a ''code'' where each one represents a different word, action or concept.
 +
# depending on the context, some numbers may represent actions, or concepts.  For example if we use the first
 +
series of numbers and say "zero three, one one" to our friend, and she responds "zero five", that "zero five"
 +
makes perfect sense for us: she's answering you "a lot" to your question about whether she liked her
 +
breakfast.  But it is not the "zero five" meaning "Have you finished..."  Some numbers, depending on
 +
whether they are part of questions of part of answers may mean different things. 
 +
 +
It's exactly the same with computers.  Some number represent just numbers.  Some numbers represent actions.
 +
Because the processor will always behave in a very predictive fashion: get a number representing an instruction,
 +
then get a number representing a true number, then there cannot be confusion.
 +
 +
 
{| style="width:100%; background:#FFD373"
 
{| style="width:100%; background:#FFD373"
 
|-
 
|-
Line 1,117: Line 1,191:
 
[[Image:CSC103MotherBoard.jpg|250px | right]]
 
[[Image:CSC103MotherBoard.jpg|250px | right]]
 
<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.).
  
 
In summary, the processor is designed to quickly access all the memory words in series, and absorbs the numbers that they contain.  And it does this very fast and automatically.  But what does it do with the numbers, and what do the numbers mean to the processor?
 
In summary, the processor is designed to quickly access all the memory words in series, and absorbs the numbers that they contain.  And it does this very fast and automatically.  But what does it do with the numbers, and what do the numbers mean to the processor?

Revision as of 10:15, 22 September 2013

--© D. Thiebaut 08:10, 30 January 2012 (EST)



This section is only visible to computers located at Smith College













.