Introduction - Texas State Department of Computer Science

Download Report

Transcript Introduction - Texas State Department of Computer Science

CS 1428 Foundations of Computer Science I
WHAT IS A COMPUTER?
Two Main Components
 Hardware
 Physical media that uses electrical current to
process instructions.
 Software
 Instructions written by humans that tell the
computer what to do.
The Modern Computer
 The Stored-Program Model
 Invented by John von Neumann
 Digital Information
 Memory
 Processor
 Input/Output
 Secondary Storage
 We will revisit this model in much more detail later
in the semester.
Organization of a von Neumann
Machine – (almost every modern
computer)
Data Bus
Memory
(RAM)
Central
Processing
Unit (CPU)
Input/Output
I/O
Secondary
Storage
Information in the Real
World
 Information that we gather through our senses is
primarily in waves and typically analog.
 Light
 Sound
 Temperature
 Etc.
 Information can be quantified down to the atom
 That’s a lot of information!
CS 1308 – Computer Literacy and the Internet
5
Information in the Computer
World
 Information in the computer world is digital.
 On/Off
 Fully Charged – Fully Discharged
 Magnetized – Demagnetized
 Computer information is binary.
 0 – Off
 1 – On
 Detecting Voltage Levels
 Why not 10 levels?
 Would be unreliable
 Not enough difference between states
CS 1308 – Computer Literacy and the Internet
6
Bits, Bytes, and so on
 A bit is one 0 or 1
 Short for “binary digit”
 A byte is a collection of 8 bits
 They named it “byte” instead of “bite” so you couldn’t easily
mess up the spelling and confuse it with “bit”.
 Anybody know what half a byte is called?
 The number of bits we have will determine how much
information we can store. (VERY IMPORTANT)




1 bit, on or off (two states)
2 bits, four different states (00, 01, 10, 11)
3 bits, eight states
In general, 2bits states
CS 1308 – Computer Literacy and the Internet
7
What is Data?
 Any useful input or output from the computer
 Documents that you are working on
 .doc, .xls, .pdf
 Music
 .mp3
 Pictures
 .jpg, .gif
 Text
 The quick Brown Fox…
 Numbers
 42, 3.14
 Readings from sensors
 Others…?
 All of these are encoded in a consistent binary format so
they can be shared between computers and users.
What is an Instruction?
 Computers rely on very simple instructions given to them by
programmers to accomplish tasks.
 Assembly Language (written by humans)
 LOAD R1, #42
 JUMP R2
 ADD R1, R2
 These instructions are translated to Machine Language
 Computers only understand ones and zeros
 1010001001010011
 1000111101001111
 1010010010100011
 Programs consist of millions of these instructions
 Machine language is different for each processor
 That is why Mac programs won’t run on a PC
Random Access Memory (RAM)
 The programs (instructions) and data are stored in the
Random Access Memory (RAM) for use by the Central
Processing Unit (CPU).
 RAM loses it’s memory when the power goes off so
we store information and programs more
permanently on Secondary Storage Devices (hard
drives, flash drives, etc.).
 Data and instructions are Fetched from the
RAM and used by the CPU to perform tasks.
 RAM is finite.
 What implications does this have for real numbers?
Central Processing Unit
(CPU)
 The CPU uses instructions to move data
around in the computer and to produce
output.
 The CPU has a simple task. Follow the
Execution Cycle over and over again, very
quickly.
 Fetch an instruction
 Decode the instruction
 Execute the instruction
Input/Output
(I/O)
 Every useful computer creates some kind of output.
 Most computers use input data of some kind to produce the
output.
 Garbage in = Garbage out
 Bad data leads to useless results.
 Devices
 Input
 Keyboard
 Mouse
 Others…?
 Output
 Monitors
 Speakers
 Others…?
Secondary Storage
 The memory in RAM goes away when the power
is shut off.
 Volatile
 Programs and data are stored more permanently
on secondary storage devices.
 Contain much more space than RAM.
 Hard Drives
 USB Drives
 DVD
 CD
 Others…?
Organization of a von Neumann
Machine – (almost every modern
computer)
Data Bus
Memory
(RAM)
Central
Processing
Unit (CPU)
Input/Output
I/O
Secondary
Storage
Quiz
 Which of the following are a computer?
 How can we tell?
 Does it have a processor?
 Does it have memory to store data and/or a
program?
 Does it use input or create output?