Download Introduction to Computing

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

The Shockwave Rider wikipedia , lookup

Wizard of Oz experiment wikipedia , lookup

Computer vision wikipedia , lookup

Human–computer interaction wikipedia , lookup

Computer Go wikipedia , lookup

Transcript
Administrivia
• Has everyone been to the course web site?
• First assignment ready – pick it up on web
• Labs to begin Monday
– Lab times: TWTH 7:30pm – 10:30pm
– Location: Friend 006/007
– Details
Pick up lab on web, read it, do it; go to
lab to get help or use the computers if you like.
• Questions??
What Does a Computer Do?
Whatever I tell it to do
• I say: Add 2 and 3 and show me the result
– Computer says: 5
• I say: Multiply that result by 7 and show me the result
– Computer says: 35
• I say: Show me the home page of the Princeton CS
department
– Computer says:
What’s Going On?
• Who’s doing the work?
• How do I tell it what to do?
The Ghost in the Machine
• Read an input and memorize it
• Read another input and memorize it
• Add the inputs and display result
• Read input and memorize it
• Multiply input with previous result
and display the result
• Hardware does the work
• Programmer writes a
program for the machine
• Program tells hardware
what to do at each step
• But not in English: In a computer programming language …
What Programs Look Like
read (a)
read (b)
c = a + b
; Read first input and store it in variable a
read (d)
e = d * c
; Read third input and store it in variable d
print (e)
; Display the value of variable e
; Read second input and store it in variable b
; Add the values of a and b and store the
result in variable c
; Multiply the values of c and d and store the
result in variable e
• The computer takes each of these instructions and executes it
The Computer’s Job
•
•
•
•
•
•
•
•
Computing outputs from inputs by performing operations
Representing and translating information
Storing, reading and writing data to/from memory
Accepting inputs from and producing outputs to the
external world (keyboards, displays, printers)
Sequencing steps
Maintaining state
Networking
Compiling and managing programs
Computer’s Job: Compute Outputs from Inputs
in1
in2
2
5
3
CPU
out = in1 + in2
out
Computer’s Job: Read/Write Variables
From/To Memory
2
2
a
5
c
3
b
5
3
CPU
Memory
c=a+b
c=a+b
Computer’s Job: Input and Output
2
a
c
b
2
CPU
Memory
2
read (a)
read (a)
read (b)
c=a+b
print (c)
Computer’s Job: Input and Output
2
a
c
3
b
3
CPU
Memory
3
read (b)
read (a)
read (b)
c=a+b
print (c)
Computer’s Job: Input and Output
2
2
a
5
c
3
b
5
3
CPU
Memory
c=a+b
read (a)
read (b)
c=a+b
print (c)
Computer’s Job: Input and Output
5
2
a
5
c
3
b
read (a)
read (b)
c=a+b
print (c)
CPU
Memory
5
print (c)
5
Computer’s Job: Representing and Translating
Information
• How does computer understand “a”, “b”, “4”, etc.
– i.e. data values?
• How does computer understand “read (a)”; that it
should add its inputs, when to read from memory,
when to take next step etc.
– i.e. control
• Answer: Everything is represented as 1’s and 0’s
– Computer only sees 1’s and 0’s
– All data values, instructions etc are encoded as
combinations of 1’s and 0’s
The World of 1’s and 0’s
0010
0010
00000
00001
0101
00010
0011
10011
0101
0011
CPU
11111
Memory
010111001
c=a+b
Computer’s Job: Sequencing
• Executing programs requires the computer to take several
discrete steps, one after another
• A “clock” is an input to the CPU that orchestrates the
sequencing
– each time clock changes its value, CPU takes next step
• So there are lots of inputs to the CPU, of different types:
– Data values (2, 3, etc)
– Program instructions (read a; c=a+b; etc)
– Clock
Computer’s Job: Maintaining State
• The computer also maintains “state” i.e. remembers
information across steps of execution; e.g.
– Holds results from previous step for use in next step
– Values of a,b and c in memory
– Internal state in CPU (later)
• Computer can be viewed as a “state machine.” It steps from
one state to another based on the current inputs, including
instructions, data and clock signal
• Except, it is a “programmable state machine.”The states and
transitions it makes are not fixed in hardware or the same
every it starts, but rather are controlled in part by program
instructions which can be changed easily (in software)
Computer’s Job: Networking
When user enters URL, CPU
needs to fetch the page.
CPU talks to a network device, asking it to
request page corresp. to the URL
Web
Server
At
Princeton CS
Memory
Network Card
Network
CPU
http://www.cs.princeton.edu
Sound Card
Graphics Card
Network device sends request to web
server www.cs.princeton.edu over the
network (Internet)
Computer’s Job: Networking
Web server sends reply (page) back,
which network device receives
Web
Server
At
Princeton CS
Memory
Network Card
Network
CPU
http://www.cs.princeton.edu
Sound Card
Graphics Card
Network device forwards the page to
CPU, which sends it to graphics device
for rendering and then to display
Computer’s Job: Compiling and
Managing Programs
• Convert high-level, human-readable programming
languages, data representations and sequencing
methods to machine-readable data, control and
sequencing in 1’s and 0’s
– Compilers do this
• Manage hardware resources so that multiple
programs can run at the same time (email, MS Word
and MP3 Player), security is provided, etc.
– Operating systems do this
Summary: The Computer’s Job
•
•
•
•
•
•
•
•
Computing outputs from inputs by performing operations
Representing and translating information
Storing, reading and writing data to/from memory
Accepting inputs from and producing outputs to the
external world (keyboards, displays, printers)
Sequencing steps
Maintaining state
Networking
Compiling and managing programs
Rest of the Course
• Hardware: Building a computer
–
–
–
–
How arithmetic and logical operations are realized
How data are represented
How memory is realized
How sequencing is done and state machines are realized
• Software: Programming and Using a computer
– Programs and Programming languages
– Algorithms
– Applications: Graphics and Sound
• Operating Systems, Networking and Distributed Computing
–
–
–
–
Operating Systems
Basic Networking
Applications: E-mail and the Internet
Peer-to-peer and music sharing
• Hard Problems and Limits of Computing
• Security, Privacy, Artificial Intelligence
Let’s Go Buy a Computer
So What’s in a Computer?
•
•
•
•
Processor brains
Memory scratch paper
Disk
long term memory
I/O
communication (senses)
• Software reconfigurability
What’s in a Computer?
Power
Disk
RAM
CPU
Communications
Ports
I/O
Text
Sound
Software
Let’s Go Buy a Computer
Computer Configuration
•
•
•
•
•
•
•
Processor (Pentium IV, 2.8 GHz)
RAM (512 MB of SDRAM (expandable))
Disk (80 GB)
CD ROM/ CD RW/DVD/…
17" XGA TFT Display (1280 x 1024 res.)
3.5" 1.44MB Floppy Disk Drive
S3 Savage IX 128-bit AGP 2x graphics
– 8MB memory, 3D Hardware acceleration, composite
TV-Out support, …
• 16-bit Sound
Computer Configuration (contd)
•
•
•
•
2 Type-I or Type-II slots or 1 Type-III slot
2 USB Ports
Built-in 56Kbps V.90 Data/fax modem
Built-in 10/100 Ethernet Adapter and
802.11b/g wireless
• Also
–
–
–
–
universal AC adapter,
built-in Lithium-Ion battery,
Microsoft Windows XP,
Encarta World Encyclopedia online version…
Putting Together an Application
•
•
•
•
•
•
Word (is a part of the Office application)
Runs on Windows (an operating system)
Which runs on a Dell PC (a computer)
Which has a Pentium (a processor)
Enhanced by connections to monitor, printer, network
Uses random access memory (RAM) to work on
document, disk (non-volatile) memory to store in
• Need a CD-ROM to install application (or install off
the Internet over a broadband connection)
What’s Special About a Computer?
•
•
•
•
•
Most complex object made by humans
A rich communication mechanism for society
Amazing how it works
Reconfigurability
Moore’s Law
More for Less --Moore’s Law
• 1985 when I was a student here
– A desktop machine in the lab
•
•
•
•
•
•
•
$150,000 (now < $1,000)
700 KHz chip (now ~3 GHz)
1 MB memory (now 128-512 MB)
80 MB disk (now 80 GB +)
CD-ROM had just been invented (83)
Minimal Internet connection
Communication to Internet 9600 bps (now 10 Mbps)
Moore’s Law (contd)
• $150,000 (now < $1,000)
– Factor of 150
• 700 Khz processor (now 2 GHz chip)
– Factor of 3000
• 1 MB memory (now 256MB)
– Factor of 256
• 80 MB disk (now 40/80 GB)
– Factor of 1000
• Communication 9600 bps (now 10 Mbps)
– Factor of 1000
An interesting example: Walmart/Microtel PC
•
•
•
•
•
•
•
•
•
•
AMD 1.5 GHz Sempron processor with 3DNow! Technology
128 MB DDR Memory, expandable to 2 GB
20 GB Ultra ATA-100 Hard Drive / 5400 RPM
52x CD-ROM drive
Integrated 10/100 Ethernet Connection
Integrated graphics up to 64 MB shared video memory
Integrated 5.1 Channel AC'97 Audio
Available drive bays: Two 5.25", one 3.5“
No operating system installed
Speakers, but no display
• Price: $198
log (people per computer)
Moore’s Law (contd)
Mainframe
Minicomputer
Workstation
PC
Laptop
PDA
???
year
* This slide and the next lifted from a presentation by David Culler
Moore’s Law (contd)
Itanium2 (241M )
nearly a thousand 8086’s
would fit in a modern
microprocessor
SOON:
Actuation
Sensing
Communication
I SDQ SD
PLL baseband
filters
mixer
LNA
Processing &
Storage
The Rest of the Course
Rest of the Course
• Hardware: Building a computer
–
–
–
–
How arithmetic and logical operations are realized
How data are represented
How memory is realized
How sequencing is done and state machines are realized
• Software: Programming and Using a computer
– Programs and Programming languages
– Algorithms
– Applications: Graphics and Sound
• Operating Systems, Networking and Distributed Computing
–
–
–
–
Operating Systems
Basic Networking
Applications: E-mail and the Internet
Peer-to-peer and music sharing
• Hard Problems and Limits of Computing
• Security, Privacy, Artificial Intelligence (?)
Hardware: Building a computer
• Start with simplest part – switch
• Build logic gates – AND/OR
– Use to solve logic problems
• Build memory
• Build processing power
– Arithmetic Unit
• Build simple programming language
Programming and Using a Computer
• How to represent data
• How to manipulate data
• How to manage information
• Algorithms
– Simple algorithms for sorting and searching
– Recursion
• Two special applications
– Picture processing on the computer
– Sound processing on the computer
Operating Systems
• Running programs
– How do you programs run and communicate
• Resource Management
– How do multiple applications share resources and run
“at the same time”
– How do you ensure that applications get their fair share
• Virtualization
– How do you hide the details of different hardware from
the upper levels of software
Networking and Distributed Applications
• How do computers communicate
– Protocols TCP/IP, HTTP, FTP, …
• The InterNet
– What it is and where it came from
– How it transports email and displays web pages
• Differing network connections
– Client/server vs. peer-to-peer
– How networks facilitate music sharing
Hard Problems and the Limits of Computing
• Hard problems
– Problems unlikely to be solved in our lifetime
– Problems unlikely to be solved in millennia
• Undecidable problems
– Problems that provably can never be solved
Security and Privacy
• Security
– Preventing break-ins, eavesdropping, etc
– Using the hardness of problems
• Privacy
– Systems are not secure
– How much information should be public
• Digital rights management
– Old ideas of copyright law may not work
– When is sharing legal? Safe communication
– Should you send your credit card over the internet?
If we have time …
• How well can computers
–
–
–
–
–
–
–
Understand written text
Understand spoken text
Understand hand drawn pictures
Play chess?
Compose music
Listen to music???
“Enjoy” music?
• Possibly a look inside a big program