cs 1428 foundations of computer science i. two main components hardware physical media that uses...

23
CS 1428 Foundations of Computer Science I

Upload: maud-helen-mathews

Post on 21-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

CS 1428 Foundations of Computer Science I

Page 2: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

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.

Page 3: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

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.

Page 4: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

Organization of a von Neumann Machine – (almost every modern computer)

Data Bus

Memory(RAM)

CentralProcessingUnit (CPU) Secondary

Storage

Input/OutputI/O

Page 5: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

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 Internet5

Page 6: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

Information in the Computer WorldInformation in the computer world is

digital.On/OffFully Charged – Fully DischargedMagnetized – Demagnetized

Computer information is binary.0 – Off1 – On

Detecting Voltage LevelsWhy not 10 levels?

Would be unreliableNot enough difference between states

CS 1308 – Computer Literacy and the Internet6

Page 7: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

Bits, Bytes, and so on

A bit is one 0 or 1Short for “binary digit”

A byte is a collection of 8 bitsThey 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 Internet7

Page 8: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

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.

Page 9: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

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

101000100101001110001111010011111010010010100011

Programs consist of millions of these instructionsMachine language is different for each processor

That is why Mac programs won’t run on a PC

Page 10: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

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?

Page 11: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

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

Page 12: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

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

KeyboardMouseOthers…?

OutputMonitorsSpeakersOthers…?

Page 13: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

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 DrivesUSB DrivesDVDCDOthers…?

Page 14: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

Organization of a von Neumann Machine – (almost every modern computer)

Data Bus

Memory(RAM)

CentralProcessingUnit (CPU) Secondary

Storage

Input/OutputI/O

Page 15: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software

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?

Page 16: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software
Page 17: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software
Page 18: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software
Page 19: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software
Page 20: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software
Page 21: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software
Page 22: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software
Page 23: CS 1428 Foundations of Computer Science I. Two Main Components  Hardware  Physical media that uses electrical current to process instructions.  Software