hardware lesson
Post on 14-Apr-2018
219 Views
Preview:
TRANSCRIPT
-
7/30/2019 Hardware Lesson
1/47
Hardware LessonCS1313 Spring 2009 1
Hardware Outline1. Hardware Outline
2. What is a Computer?3. Components of a Computer
4. Categories of Computer Hardware
5. Central Processing Unit (CPU)
6. CPU Examples
7. CPU Parts
8. CPU: Control Unit
9. CPU: Arithmetic/Logic Unit
10. CPU: Registers11. How Registers Are Used
12. Multicore
13. Multicore History
14. Storage
15. Primary Storage
16. Cache
17. From Cache to the CPU
18. Main Memory (RAM)19. Main Memory Layout
20. RAM vs ROM
21. Speed => Price => Size
22. How Data Travel Between RAM and CPU
23. Loading Data from RAM into the CPU
24. RAM is Slow
25. Why Have Cache?26. Secondary Storage
27. Media Types
28. Speed, Price, Size
29. CD-ROM & DVD-ROM
30. CD-ROM & DVD-ROM: Disadvantage
31. CD-ROM & DVD-ROM: Advantages
32. Why Are Floppies So Expensive Per MB?
33. I/O34. I/O: Input Devices
35. I/O: Output Devices
36. Bits
37. Bytes
38. Words
39. Putting Bits Together
40. Putting Bits Together (contd)
41. Powers of 242. Powers of 2 vs Powers of 10
43. KB, MB, GB, TB, PB
44. Kilo, Mega, Giga, Tera, Peta
45. Moores Law
46. Implication of Moores Law
47. Double, double,
-
7/30/2019 Hardware Lesson
2/47
Hardware LessonCS1313 Spring 2009 2
What is a Computer?
[A] programmable electronic device
that can store, retrieve and process data.(N. Dale & D. Orshalick,
Introduction to PASCAL and Structured
Design,D.C. Heath & Co.,
Lexington MA, 1983, p. 2)
-
7/30/2019 Hardware Lesson
3/47
Hardware LessonCS1313 Spring 2009 3
Components of a Computer
Computer
HardwarePhysical Devices
SoftwareInstructions & Data
DONT PANIC!This discussion may be confusing at the moment;
itll make more sense after youve written a few programs.
-
7/30/2019 Hardware Lesson
4/47
Hardware LessonCS1313 Spring 2009 4
Categories of Computer Hardware
Central Processing Uni t(CPU) Storage
Primary: Cache, RAM
Secondary: Hard disk, removable (e.g., CD)
I /O
Input Devices
Output Devices
-
7/30/2019 Hardware Lesson
5/47
Hardware LessonCS1313 Spring 2009 5
Central Processing Unit (CPU)
The Central Processing Unit(CPU), also called theprocessor, is the brain of the computer.
Harpertown exteriorhttp://blogs.zdnet.com/Apple/images/intel-xeon.jpg
Intel Pentium4 Xeon Harpertown Quad Core
Innardshttp://media.arstechnica.com/reviews/hardware/mac-pro-2g-review.media/quadcoredie.jpg
http://blogs.zdnet.com/Apple/images/intel-xeon.jpghttp://media.arstechnica.com/reviews/hardware/mac-pro-2g-review.media/quadcoredie.jpghttp://media.arstechnica.com/reviews/hardware/mac-pro-2g-review.media/quadcoredie.jpghttp://media.arstechnica.com/reviews/hardware/mac-pro-2g-review.media/quadcoredie.jpghttp://media.arstechnica.com/reviews/hardware/mac-pro-2g-review.media/quadcoredie.jpghttp://media.arstechnica.com/reviews/hardware/mac-pro-2g-review.media/quadcoredie.jpghttp://media.arstechnica.com/reviews/hardware/mac-pro-2g-review.media/quadcoredie.jpghttp://media.arstechnica.com/reviews/hardware/mac-pro-2g-review.media/quadcoredie.jpghttp://media.arstechnica.com/reviews/hardware/mac-pro-2g-review.media/quadcoredie.jpghttp://blogs.zdnet.com/Apple/images/intel-xeon.jpghttp://blogs.zdnet.com/Apple/images/intel-xeon.jpghttp://blogs.zdnet.com/Apple/images/intel-xeon.jpg -
7/30/2019 Hardware Lesson
6/47
Hardware LessonCS1313 Spring 2009 6
CPU Examples
Intel Pentium 4/AMD Athlon (Windows PCs) Intel Itanium2 (servers)
Qualcomm MSM (cell phones)
IBM POWER6 (servers) Sun UltraSPARC (servers)
-
7/30/2019 Hardware Lesson
7/47
Hardware LessonCS1313 Spring 2009 7
CPU Parts
Arithmetic/Logic UnitControl Unit Registers
Fetch Next Instruction Add Sub
Mult Div
And Or
Not
Integer
Floating Point
Fetch Data Store Data
Increment Instruction Ptr
Execute Instruction
The CPU consists of three main parts: Control Unit
Arithmetic/Logic Unit
Registers
-
7/30/2019 Hardware Lesson
8/47
Hardware LessonCS1313 Spring 2009 8
CPU: Control Unit
The Control Uni tdecides what to do next.For example:
memory operations: for example,
loaddata from
main memory(RAM) into the
registers;
storedata from the registers into main memory;
arithmetic/logical operations: e.g., add, multiply;
branch: choose among several possible courses of
action.
-
7/30/2019 Hardware Lesson
9/47
Hardware LessonCS1313 Spring 2009 9
CPU: Arithmetic/Logic Unit
The Ar ithmetic/Logic Unit(ALU) performsarithmetic and logical operations.
Arithmetic operations: e.g., add, subtract,
multiply, divide, square root, cosine, etc.
Logical operations: e.g., compare two numbers to
see which is greater, check whether a true/false
statement is true, etc.
-
7/30/2019 Hardware Lesson
10/47
Hardware LessonCS1313 Spring 2009 10
CPU: Registers
Registersare memory-like locations inside the CPUwhere data and instructions reside that are beingused right now.
That is, registers hold the operands being used by thecurrent arithmetic or logical operation, or the resultof the arithmetic or logical operation that was just
performed.
For example, if the CPU is adding two numbers, thenthe addend is in some register, the augend is inanother register, and after the addition is performed,the sum shows up in yet another register.
A typical CPU has only a few hundred to a fewthousand bytes of registers.
-
7/30/2019 Hardware Lesson
11/47
Hardware LessonCS1313 Spring 2009 11
How Registers Are Used
Every arithmetic or logical operation has one ormore operands and one result.
Operands are contained in registers (source).
A black box of circuits performs the operation.
The result goes into a register (destination).
Example:
addend in R0
augend in R1ADD sum in R2
5
712
Register Ri
Register Rj
Register Rk
operand
operand
result
Operation circuitry
-
7/30/2019 Hardware Lesson
12/47
Hardware LessonCS1313 Spring 2009 12
Multicore
A multicoreCPU is a chip with multiple,independent brains, known as cores.
These multiple cores can run completely separate
programs, or they can cooperate together to work
simultaneously in parallel on different parts of the
same program.
All of the cores share the same connection to
memoryand the same bandwidth (memoryspeed).
-
7/30/2019 Hardware Lesson
13/47
Hardware LessonCS1313 Spring 2009 13
Multicore History
Dual core: October 2005 Quad core: June 2006
Hex core: September 2008
Oct core: estimated late 2009http://www.intel.com/pressroom/kits/quickreffam.htm (dual, quad, hex)http://en.wikipedia.org/wiki/Intel_Nehalem_(microarchitecture) (oct)
http://www.intel.com/pressroom/kits/quickreffam.htmhttp://en.wikipedia.org/wiki/Intel_Nehalem_(microarchitecture)http://en.wikipedia.org/wiki/Intel_Nehalem_(microarchitecture)http://www.intel.com/pressroom/kits/quickreffam.htm -
7/30/2019 Hardware Lesson
14/47
Hardware LessonCS1313 Spring 2009 14
Storage
There are two major categories of storage: Primary
Cache
Main memory (RAM)
Secondary
Hard disk
Removable (e.g., CD, floppy)
-
7/30/2019 Hardware Lesson
15/47
Hardware LessonCS1313 Spring 2009 15
Primary Storage
Primary storageis where data and instructions residewhen theyre being used by a program that is
currently running.
Typically is volatile: The data disappear when the
power is turned off.
Typically comes in two subcategories:
Cache
Main memory (RAM)
-
7/30/2019 Hardware Lesson
16/47
Hardware LessonCS1313 Spring 2009 16
Cache
Cachememory is where data and instructions residewhen they are going to be used very very soon, or
have just been used.
Cache is very fast (typically 20% - 100% of the
speed of the registers).
Therefore, its very expensive (e.g., $5 per MB)http://www.pricewatch.com/
Therefore, its very small (e.g., 1/4
MB to 12 MB)
but still much bigger than registers.
http://www.pricewatch.com/http://www.pricewatch.com/ -
7/30/2019 Hardware Lesson
17/47
Hardware LessonCS1313 Spring 2009 17
From Cache to the CPU
Typically, data move between cache and the CPU at speeds
comparable to that of the CPU performing calculations.
CPU
Cache
253 GB/sec (72%) on a1.83 GHz Pentium4 Core Duo
351 GB/sec on a1.83 GHz Pentium4 Core Duo
http://www.dell.com/
http://www.dell.com/http://www.dell.com/ -
7/30/2019 Hardware Lesson
18/47
Hardware LessonCS1313 Spring 2009 18
Main Memory (RAM)
Main memory(RAM) is where data and instructionsreside when a program that is currently runningis going to use them at some point during the run(whether soon or not).
Much slower than cache(e.g., about 1-5% of CPU speed for RAM,vs 20-100% of CPU speed for cache)
Therefore, much cheaper than cache
(e.g., $0.03/MB for RAM vs $5/MB for cache) Therefore, much larger than cache
(e.g., 1-32 GB for RAM vs1/4 MB to 12 MB for cache)
-
7/30/2019 Hardware Lesson
19/47
Hardware LessonCS1313 Spring 2009 19
Main Memory Layout
Main memory is made upoflocations, also knownas cells.
Each location has aunique integeraddress
that never changes.Each location has avaluealso knownas the contentsthat the CPU canlook at and change.
We can think ofmemory as onecontiguouslineof cells.
-
7/30/2019 Hardware Lesson
20/47
Hardware LessonCS1313 Spring 2009 20
RAM vs ROM
RAM: Random Access Memory
Memory that the CPU can look at and changearbitrarily (i.e., can load from or store into anylocation at any time, not just in a sequence).
We often use the phrases Main Memory, Memoryand RAM interchangeably.
Sometimes known as corememory, named for anolder memory technology. (Note that this use of
the word core is unrelated to dual core.)ROM: Read Only Memory
Memory that the CPU can look at arbitrarily, butcannot change.
-
7/30/2019 Hardware Lesson
21/47
Hardware LessonCS1313 Spring 2009 21
Speed => Price => Size
Registers are VERY fast, because they are etcheddirectly into the CPU.
Cache is also very fast, because its also etched intothe CPU, but it isnt directly connected to the ControlUnit or Arithmetic/Logic Unit. Cache operates atspeeds similar to registers, but cache is MUCH biggerthan the collection of registers (typically on the orderof 1,000 to 10,000 times as big).
Main memory (RAM) is much slower than cache,because it isnt part of the CPU; therefore, its muchcheaperthan cache, and therefore its much biggerthan cache (for example, 1,000 times as big).
-
7/30/2019 Hardware Lesson
22/47
Hardware LessonCS1313 Spring 2009 22
How Data Travel Between RAM and CPU
CPUThe bus is theconnection from the
CPU to main memory;
all data travel along it.
For now, we canthink of the bus as a
big wire connecting
them.
-
7/30/2019 Hardware Lesson
23/47
Hardware LessonCS1313 Spring 2009 23
Loading Data from RAM into the CPU
-
7/30/2019 Hardware Lesson
24/47
Hardware LessonCS1313 Spring 2009 24
RAM is Slow
CPU
10.66 GB/sec (3%)ftp://download.intel.com/design/Pentium4/papers/24943801.pdf
351 GB/sec on a
1.83 GHz Pentium4Core DuoRichard Gerber, The Software Optimization Cookbook: High-performance
Recipes for the Intel Architecture. Intel Press, 2002, pp. 161-168.
Bottleneck
The speed of data transfer
between Main Memory andthe CPU is much slower thanthe speed of calculating, sothe CPU spends most of itstime waiting for data to comein or go out.
ftp://download.intel.com/design/Pentium4/papers/24943801.pdfftp://download.intel.com/design/Pentium4/papers/24943801.pdf -
7/30/2019 Hardware Lesson
25/47
Hardware LessonCS1313 Spring 2009 25
Why Have Cache?
CPUCache is nearly the samespeed as the CPU, so theCPU doesnt have to waitnearly as long for stuffthats already in cache: itcan do more operations
per second!
253 GB/sec (72%)http://www.anandtech.com/showdoc.html?i=1460&p=2
10.66 GB/sec (3%)ftp://download.intel.com/design/Pentium4/papers/24943801.pdf
351 GB/sec on a
1.83 GHz Pentium4Core DuoRichard Gerber, The Software Optimization Cookbook: High-performance
Recipes for the Intel Architecture. Intel Press, 2002, pp. 161-168.
http://www.anandtech.com/showdoc.html?i=1460&p=2ftp://download.intel.com/design/Pentium4/papers/24943801.pdfftp://download.intel.com/design/Pentium4/papers/24943801.pdfhttp://www.anandtech.com/showdoc.html?i=1460&p=2 -
7/30/2019 Hardware Lesson
26/47
Hardware LessonCS1313 Spring 2009 26
Secondary Storage
Where data and instructions reside that are going tobe used in the future
Nonvolatile: data dont disappear when power is
turned off.
Much slower than RAM, therefore much cheaper,
therefore much larger.
Other than hard disk, most are portable: they can be
easily removed from your computer and taken tosomeone elses.
-
7/30/2019 Hardware Lesson
27/47
Hardware LessonCS1313 Spring 2009 27
Media Types
Magnetic: Always can be read
Always can be written and rewritten multiple times
Contents degrade relatively rapidly over time
Can be erased by magnets
Optical Always can be read
Some can be written only once, some can be rewrittenmultiple times
Contents degrade more slowly than magnetic media Cant be erased by magnets
Paper: forget about it!
-
7/30/2019 Hardware Lesson
28/47
Hardware LessonCS1313 Spring 2009 28
Speed, Price, Size
Medium Speed
(MB/sec)
Size
(MB)
Media
Type
Can write
to it?
Port-
able?
Pop-
ular?
Drive
cost ($)
Media cost
($/MB)Cache 269,257 12 L2/L3 Y N Reqd $5
RAM 21,328 32,768 DDR2 Y N Reqd $0.03
Hard Disk 100 1,500,000 Mag Y N Reqd $0.0001
Blu-ray 17 25,000 Opt Y Y Soon $120 $0.0002
DVD+RW 16 8500 Opt Y Y Y $24 $0.00003
CD-RW 7.6 700 Opt Y Y Y $14 $0.0002
Mag tape 15 800,000 Mag Y Y N $2000 $0.00006
Floppy 0.03 1.44 Mag Y Y Y $9 $0.09
Cassette
-
7/30/2019 Hardware Lesson
29/47
Hardware LessonCS1313 Spring 2009 29
CD-ROM/DVD-ROM/BD-ROM
When a CD or DVD or Blu-ray holds data instead ofmusic or a movie, it acts very much like Read Only
Memory (ROM):
it can only be read from, but not written to;
its nonvolatile;
it can be addressed essentially arbitrarily (its not
actually arbitrary, but its fast enough that it might
as well be).
-
7/30/2019 Hardware Lesson
30/47
Hardware LessonCS1313 Spring 2009 30
CD-ROM/DVD-ROM/BD-ROM: Disadvantage
Disadvantage of CD-ROM/DVD-ROM/BD-ROMcompared to ROM: speed.
CD-ROM/DVD-ROM/BD-ROM are much slower
than ROM.
CD-ROM is 7.6 MB/sec (peak); DVD-ROM is 16
MB/sec; BD-ROM is 17 MB/sec.
Most ROM these days is 21,328 MB/sec (1200+ times
as fast as DVD or Blu-ray and 2800 times as fast as
CD).
-
7/30/2019 Hardware Lesson
31/47
Hardware LessonCS1313 Spring 2009 31
CD-ROM & DVD-ROM: Advantages
Advantages of CD-ROM/DVD-ROM compared toROM:
CD-ROM and DVD-ROM are much cheaper thanROM.
Blank CDs and blank BDs are roughly $0.0002 per MB;blank DVDs are roughly $0.00003 per MB.
ROM is even more expensive than RAM (which is$0.03/MB), because it has to be made special.
CD-ROM and DVD-ROM are much largertheycan have arbitrary amount of storage (on manyCDs or DVDs); ROM is limited to a few GB.
-
7/30/2019 Hardware Lesson
32/47
Hardware LessonCS1313 Spring 2009 32
Why Are Floppies So Expensive Per MB?
CD-RWs cost roughly $0.0002 per MB, but floppydisks cost about $0.09 per MB, 450 times as
expensive per MB. Why?
Well, an individual CD has much greater capacity
than an individual floppy (700 MB vs. 1.44 MB),and the costs of manufacturing the actual physical
objects are similar.
So, the cost of a floppy per MB is much higher.
-
7/30/2019 Hardware Lesson
33/47
Hardware LessonCS1313 Spring 2009 33
I/O
We often sayI /O
as a shorthand forInput/Output.
-
7/30/2019 Hardware Lesson
34/47
Hardware LessonCS1313 Spring 2009 34
I/O: Input Devices
We often sayI /O
as a shorthand forInput/Output.
I nput Devicestransfer data into computer (e.g., from
a user into memory).
For example: Keyboard
Mouse Scanner
Microphone Touchpad
Joystick
-
7/30/2019 Hardware Lesson
35/47
Hardware LessonCS1313 Spring 2009 35
I/O: Output Devices
We often sayI /O
as a shorthand forInput/Output.
Output Devicestransfer data out of computer (e.g.,
from memory to a user).
For example: Monitor
Printer
Speakers
-
7/30/2019 Hardware Lesson
36/47
Hardware LessonCS1313 Spring 2009 36
Bits
Bit(Binary digIT) Tiniest possible piece of memory. Made of teeny tiny transistors wired together.
Has 2 possible values that we can think of in
several ways: Low or High: Voltage into transistor Off or On: Conceptual description of transistor state
False or True: Booleanvalue for symbolic logic
0 or 1: Integer value
Bits arent individually addressable: the CPU cantload from or store into an individual bit ofmemory.
-
7/30/2019 Hardware Lesson
37/47
Hardware LessonCS1313 Spring 2009 37
Bytes
Byte: a sequence of 8 contiguous bits (typically) On most platforms(kinds of computers), its the
smallest addressablepiece of memory: typically,
the CPU can load from or store into an individual
byte.
Possible integer values: 0..255 or -128..127 (to be
explained later)
Can also represent a character (e.g., letter, digit,punctuation; to be explained later)
-
7/30/2019 Hardware Lesson
38/47
Hardware LessonCS1313 Spring 2009 38
Words
Word: a sequence of 4 or 8 contiguous bytes(typically); i.e., 32 or 64 contiguous bits
Standard size for storing a number (integer or
real)
Standard size for storing an address (special kind
of integer)
-
7/30/2019 Hardware Lesson
39/47
Hardware LessonCS1313 Spring 2009 39
Putting Bits Together
1 bit: 21
= 2 possible values: or2 bits: 22 = 4 possible values
3 bits: 23 = 8 possible values
0 1
0 0 0 01 1 1 1
0 0 0 0 0 1 0 1 10 0 1
1 0 0 1 0 1 1 1 0 1 1 1
-
7/30/2019 Hardware Lesson
40/47
Hardware LessonCS1313 Spring 2009 40
Putting Bits Together (contd)
4 bits: 24
= 16 possible values
8 bits: 28 = 256 possible values
10 bits: 210 = 1,024 possible values
16 bits: 216 = 65,536 possible values
32 bits: 232 = 4,294,967,296 possible values
(typical size of an integer in most computers today)
-
7/30/2019 Hardware Lesson
41/47
Hardware LessonCS1313 Spring 2009 41
Powers of 2
20 = 1 211 = 2,048
21 = 2 212 = 4,096
22 = 4 213 = 8,192
23 = 8 214 = 16,384
24 = 16 215 = 32,76825 = 32 216 = 65,536
26 = 64 217 = 131,072
27 = 128 218 = 262,144
28 = 256 219 = 524,288
29 = 512 220 = 1,048,576
210 = 1,024 (about a thousand)
(about a million)
-
7/30/2019 Hardware Lesson
42/47
Hardware LessonCS1313 Spring 2009 42
Powers of 2 vs Powers of 10
A rule of thumb for comparing powers of 2to powers of 10:
210 ~ 103
So:
210 ~ 1,000 (thousand) 220 ~ 1,000,000 (million)
230 ~ 1,000,000,000 (billion)
2
40
~ 1,000,000,000,000 (trillion) 250 ~ 1,000,000,000,000,000 (quadrillion)
260 ~ 1,000,000,000,000,000,000 (quintillion)
-
7/30/2019 Hardware Lesson
43/47
Hardware LessonCS1313 Spring 2009 43
KB, MB, GB, TB, PB
Kilobyte(KB): 210 bytes, which is approximately
1,000 bytes (thousand)
Megabyte(MB): 220 bytes, which is approximately
1,000,000 bytes (million)
Gigabyte(GB): 230 bytes, which is approximately
1,000,000,000 bytes (billion)
Terabyte(TB): 240 bytes, which is approximately
1,000,000,000 bytes (trillion)
Petabyte(PB): 250 bytes, which is approximately
1,000,000,000,000,000 bytes (quadrillion)
Exabyte(EB): 260 bytes, which is approximately
1,000,000,000,000,000,000 bytes (quintillion)
-
7/30/2019 Hardware Lesson
44/47
Hardware LessonCS1313 Spring 2009 44
Kilo, Mega, Giga, Tera, Peta
Kilobyte (KB): 210 bytes = 1,024 bytes ~ 1,000 bytes
Approximate size: one e-mail (plain text)
Desktop Example: TRS-80 w/4 KB RAM (1977)
Megabyte (MB): 220 bytes = 1,048,576 bytes ~ 1,000,000 bytes
Approximate size: 30 phonebook pages
Desktop Example: IBM PS/2 PC w/1 MB RAM (1987)Gigabyte (GB): 230 bytes = 1,073,741,824 bytes ~ 1,000,000,000 bytes
Approximate size: 15 copies of the OKC white pages
Desktop: c. 1997
Terabyte (TB): 240 bytes = 1,099,511,627,776 bytes ~ 1,000,000,000,000 bytes
Approximate size: 5,500 copies of a phonebook listing everyone in the world
Desktop: ??? (Jan 2009: 32 GB)
Petabyte (PB): 250 bytes ~ 1,000,000,000,000,000 bytes
Desktop: ???
-
7/30/2019 Hardware Lesson
45/47
Hardware LessonCS1313 Spring 2009 45
Moores Law
Moores Law: Computing speed and capacity double every18 to 24 months.
In 1965 Gordon Moore (Chairman Emeritus, Intel Corp)observed the doubling of transistor density on amanufactured die every year.
People have noticed that computing speed and capacity areroughly proportional to transistor density.
Moores Law is usually hedged by saying that computingspeed doubles every 18-24 months (typically 18).
See:http://www.intel.com/technology/mooreslaw/
http://www.intel.com/pressroom/kits/quickreffam.htm
http://www.intel.com/technology/mooreslaw/http://www.intel.com/pressroom/kits/quickreffam.htmhttp://www.intel.com/pressroom/kits/quickreffam.htmhttp://www.intel.com/technology/mooreslaw/ -
7/30/2019 Hardware Lesson
46/47
Hardware LessonCS1313 Spring 2009 46
Implication of Moores Law
If computing speed and capacity double every 18months, what are the implications in our lives?
Well, the average undergrad student isto one
significant figureabout 20 years old.
And the average lifespan in the USto one
significant figureis about 80 years.
So, the average undergrad student has 60 years to go.
So how much will computing speed and capacityincrease during the time you have left?
-
7/30/2019 Hardware Lesson
47/47
Hardware Lesson
Double, double,
60 years / 18 months = 40 doublingsWhat is 240?
Consider the computer on your desktop today,
compared to the computer on your desktop the dayyou die.
How much faster will it be?
Can we possibly predict what the future of computingwill enable us to do?
top related