cs1313 hardware lesson - university of oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17....

45
Hardware Lesson CS1313 Spring 2007 1 Hardware Outline 1. 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: Registers 11. How Registers Are Used 12. Storage 13. Primary Storage 14. Cache 15. From Cache to the CPU 16. Main Memory (RAM) 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel Between RAM and CPU 21. Loading Data from RAM into the CPU 22. RAM is Slow 23. Why Have Cache? 24. Secondary Storage 25. Media Types 26. Speed, Price, Size 27. CD-ROM & DVD-ROM 28. CD-ROM & DVD-ROM: Disadvantage 29. CD-ROM & DVD-ROM: Advantages 30. Why Are Floppies So Expensive Per MB? 31. I/O 32. I/O: Input Devices 33. I/O: Output Devices 34. Bits 35. Bytes 36. Words 37. Putting Bits Together 38. Putting Bits Together (cont’d) 39. Powers of 2 40. Powers of 2 vs Powers of 10 41. KB, MB, GB, TB, PB 42. Kilo, Mega, Giga, Tera, Peta 43. Moore’s Law 44. Implication of Moore’s Law 45. Double, double, …

Upload: others

Post on 10-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 1

Hardware Outline1. Hardware Outline2. What is a Computer?3. Components of a Computer4. Categories of Computer Hardware5. Central Processing Unit (CPU)6. CPU Examples7. CPU Parts8. CPU: Control Unit9. CPU: Arithmetic/Logic Unit10. CPU: Registers11. How Registers Are Used12. Storage13. Primary Storage14. Cache15. From Cache to the CPU16. Main Memory (RAM)17. Main Memory Layout18. RAM vs ROM19. Speed => Price => Size20. How Data Travel Between RAM and CPU21. Loading Data from RAM into the CPU22. RAM is Slow23. Why Have Cache?

24. Secondary Storage25. Media Types26. Speed, Price, Size27. CD-ROM & DVD-ROM28. CD-ROM & DVD-ROM: Disadvantage29. CD-ROM & DVD-ROM: Advantages30. Why Are Floppies So Expensive Per MB?31. I/O32. I/O: Input Devices33. I/O: Output Devices34. Bits35. Bytes36. Words37. Putting Bits Together38. Putting Bits Together (cont’d)39. Powers of 240. Powers of 2 vs Powers of 1041. KB, MB, GB, TB, PB42. Kilo, Mega, Giga, Tera, Peta43. Moore’s Law44. Implication of Moore’s Law45. Double, double, …

Page 2: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 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)

Page 3: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 3

Components of a Computer

Computer

HardwarePhysical Devices

SoftwareInstructions & Data

DON’T PANIC!This discussion may be confusing at the moment;

it’ll make more sense after you’ve written a few programs.

Page 4: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 4

Categories of Computer Hardware

Central Processing Unit (CPU)Storage

Primary: Cache, RAMSecondary: Hard disk, removable (e.g., CD)

I/OInput DevicesOutput Devices

Page 5: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 5

Central Processing Unit (CPU)

The Central Processing Unit (CPU), also called the processor, is the “brain” of the computer.

Intel PentiumD (exterior)http://www.tomshardware.com/2005/04/05/the_pentium_d/

Intel PentiumD Smithfield Dual Core Innardshttp://www.tomshardware.com/2005/04/05/the_pentium_d/page3.html

Page 6: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 6

CPU Examples

Intel Pentium 4/AMD Athlon (Windows PCs)Motorola PowerPC (used to be in Apple Macs)Intel Itanium2 (servers)

Page 7: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 7

CPU Parts

Arithmetic/Logic UnitControl Unit RegistersFetch 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 UnitArithmetic/Logic UnitRegisters

Page 8: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 8

CPU: Control Unit

The Control Unit decides what to do next.For example:

memory operations: for example,load data from main memory (RAM) into the registers;store data from the registers into main memory;

arithmetic/logical operations: e.g., add, multiply;branch: choose among several possible courses of action.

Page 9: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 9

CPU: Arithmetic/Logic Unit

The Arithmetic/Logic Unit (ALU) performs arithmetic 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.

Page 10: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 10

CPU: RegistersRegisters are memory-like locations inside the CPU

where data and instructions reside that are being used right now.

That is, registers hold the operands being used by the current arithmetic or logical operation, or the result of the arithmetic or logical operation that was just performed.

For example, if the CPU is adding two numbers, then the addend is in some register, the augend is in another 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 few thousand bytes of registers.

Page 11: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 11

How Registers Are UsedEvery arithmetic or logical operation has one or more 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”).

Exa

mpl

e:

addend in R0

augend in R1ADD sum in R2

5

712

Register Ri

Register RjRegister Rk

operand

operand

result

Operation circuitry

Page 12: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 12

Storage

There are two major categories of storage:Primary

CacheMain memory (RAM)

SecondaryHard diskRemovable (e.g., CD, floppy)

Page 13: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 13

Primary Storage

Primary storage is where data and instructions reside when they’re 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:

CacheMain memory (RAM)

Page 14: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 14

Cache

Cache memory is where data and instructions reside when they are going to be used very very soon, or have just been used.Cache is very fast (typically 50% - 100% of the speed of the registers).Therefore, it’s very expensive (e.g., $21 per MB) http://www.pricewatch.com/

Therefore, it’s very small (e.g., 1/8 MB to 4 MB)… but still much bigger than registers.

Page 15: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 15

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/

Page 16: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 16

Main Memory (RAM)Main memory (RAM) is where data and instructions

reside 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-10% of CPU speed for RAM, vs 50-100% of CPU speed for cache)Therefore, much cheaper than cache(e.g., $0.10/MB for RAM vs $21/MB for cache)Therefore, much larger than cache(e.g., 128 MB to 16,384 MB for RAM vs

1/8 MB to 4 MB for cache)

Page 17: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 17

Main Memory LayoutMain memory is made up of locations, also known as cells.Each location has a unique integer addressthat never changes.Each location has a value – also known as the contents –that the CPU can look at and change.We can think of memory as one contiguous line of cells.

Page 18: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 18

RAM vs ROMRAM: Random Access Memory

Memory that the CPU can look at and change arbitrarily (i.e., can load from or store into any location at any time, not just in a sequence).We often use the phrases Main Memory, Memoryand RAM interchangeably.Sometimes known as core memory, named for an older memory technology. (Note that this use of the word “core” is unrelated to “dual core.”)

ROM: Read Only MemoryMemory that the CPU can look at arbitrarily, but cannot change.

Page 19: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 19

Speed => Price => SizeRegisters are VERY fast, because they are etched directly into the CPU.Cache is also very fast, because it’s also etched into the CPU, but it isn’t directly connected to the Control Unit or Arithmetic/Logic Unit. Cache operates at speeds similar to registers, but cache is MUCH biggerthan the collection of registers (typically on the order of 1,000 to 10,000 times as big).Main memory (RAM) is much slower than cache, because it isn’t part of the CPU, and because it’s slower it’s much cheaper than cache, and therefore it’s much bigger than cache (e.g., 1,000 times as big).

Page 20: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 20

How Data Travel Between RAM and CPU

CPUThe bus is the connection from the CPU to main memory;all data travel along it.

For now, we can think of the bus as a big wire connecting them.

Page 21: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 21

Loading Data from RAM into the CPU

Page 22: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 22

RAM is Slow

CPU

3.2 GB/sec (5%)ftp://download.intel.com/design/Pentium4/papers/24943801.pdf

351 GB/sec on a1.5 GHz Pentium4 Core Duo

Bottleneck

Richard Gerber, The Software Optimization Cookbook: High-performance Recipes for the Intel Architecture. Intel Press, 2002, pp. 161-168.

The speed of data transferbetween Main Memory and the CPU is much slower than the speed of calculating, so the CPU spends most of its time waiting for data to come in or go out.

Page 23: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 23

Why Have Cache?

CPUCache is nearly the same speed as the CPU, so the CPU doesn’t have to wait nearly as long for stuff that’s already in cache: it can do more operations per second!

253 GB/sec (72%)http://www.anandtech.com/showdoc.html?i=1460&p=2

3.2 GB/sec (5%)ftp://download.intel.com/design/Pentium4/papers/24943801.pdf

351 GB/sec on a1.5 GHz Pentium4 Core DuoRichard Gerber, The Software Optimization Cookbook: High-performance Recipes for the Intel Architecture. Intel Press, 2002, pp. 161-168.

Page 24: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 24

Secondary Storage

Where data and instructions reside that are going to be used in the futureNonvolatile: data don’t 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 to someone else’s.

Page 25: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 25

Media TypesMagnetic:

Always can be readAlways can be written and rewritten multiple timesContents degrade relatively rapidly over timeCan be erased by magnets

OpticalAlways can be readSome can be written only once, some can be rewritten multiple timesContents degrade more slowly than magnetic mediaCan’t be erased by magnets

Paper: forget about it!

Page 26: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 26

Speed, Price, SizeMedium Speed

(MB/sec)Size

(MB)Media Type

Can write to it?

Port-able?

Pop-ular?

Drive cost ($)

Media cost ($/MB)

Cache 269,257 2 L2/L3 Y N Req’d $21

RAM 10,664 16,384 DDR2 Y N Req’d $0.10

Hard Disk 100 750,000 Mag Y N Req’d $0.0004

DVD+RW 16 21,000 Opt Y Y Y $20 $0.00005

CD-RW 7.6 700 Opt Y Y Y $20 $0.0003

Zip disk 2.4 250 Mag Y Y Was $25 $0.016

Mag tape 15 500,000 Mag Y Y N $1600 $0.0001

Floppy 0.03 1.44 Mag Y Y Y $8 $0.13

Cassette << 1 << 1 Mag Y Y Historical

Paper tape << 1 << 1 Paper Y Y Historical

Punch card << 1 << 1 Paper Y Y Historical

* Maximum among models commonly available for PCsNote: All numbers are approximate as of Jan 2007 (bestbuy.com, buy.com, cendyne.com,creativelabs.com, dell.com, pricewatch.com, sony.com, storagetek.com, toshiba.com).

Page 27: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 27

CD-ROM & DVD-ROM

When a CD or DVD holds data instead of music or a movie, it acts very much like Read Only Memory (ROM):it can only be read from, but not written to;it’s nonvolatile;it can be addressed essentially arbitrarily (it’s not actually arbitrary, but it’s fast enough that it might as well be).

Page 28: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 28

CD-ROM & DVD-ROM: Disadvantage

Disadvantage of CD-ROM/DVD-ROM compared to ROM:CD-ROM and DVD-ROM are much slower than ROM.

CD-ROM is 7.6 MB/sec (peak); DVD-ROM is 16 MB/sec.Most ROM these days is 10,916 MB/sec (roughly 700 times as fast as DVD and 1400 times as fast as CD).

Page 29: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 29

CD-ROM & DVD-ROM: Advantages

Advantages of CD-ROM/DVD-ROM compared to ROM:CD-ROM and DVD-ROM are much cheaper than ROM.

Blank CDs and blank DVDs are less than $0.0005/MB.ROM is even more expensive than RAM (which is $0.10/MB), because it has to be made special.

CD-ROM and DVD-ROM are much larger – they can have arbitrary amount of storage (on many CDs or DVDs); ROM is limited to a few GB.

Page 30: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 30

Why Are Floppies So Expensive Per MB?

CD-RWs cost less than $0.0005 per MB, but floppy disks cost about $0.13 per MB. Why?

Well, an individual CD has much greater capacitythan 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.

Page 31: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 31

I/OWe often say I/O as a shorthand for

“Input/Output.”

Page 32: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 32

I/O: Input DevicesWe often say I/O as a shorthand for

“Input/Output.”Input Devices transfer data into computer (e.g., from

a user into memory).For example:

KeyboardMouseScannerMicrophoneTouchpadJoystick

Page 33: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 33

I/O: Output DevicesWe often say I/O as a shorthand for

“Input/Output.”Output Devices transfer data out of computer (e.g.,

from memory to a user).For example:

MonitorPrinterSpeakers

Page 34: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 34

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 transistorOff or On: Conceptual description of transistor stateFalse or True: Boolean value for symbolic logic0 or 1: Integer value

Bits aren’t individually addressable: the CPU can’t load from or store into an individual bit of memory.

Page 35: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 35

Bytes

Byte: a sequence of 8 contiguous bits (typically)On most platforms (kinds of computers), it’s the smallest addressable piece 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)

Page 36: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 36

Words

Word: a sequence of 4 or 8 contiguous bytes (typically); i.e., 32 or 64 contiguous bitsStandard size for storing a number (integer or real)Standard size for storing an address (special kind of integer)

Page 37: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 37

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

Page 38: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 38

Putting Bits Together (cont’d)

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)

Page 39: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 39

Powers of 220 = 1 211 = 2,04821 = 2 212 = 4,09622 = 4 213 = 8,19223 = 8 214 = 16,38424 = 16 215 = 32,76825 = 32 216 = 65,53626 = 64 217 = 131,07227 = 128 218 = 262,14428 = 256 219 = 524,28829 = 512 220 = 1,048,576

210 = 1,024 (about a thousand)(about a million)

Page 40: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 40

Powers of 2 vs Powers of 10

A rule of thumb for comparing powers of 2 to powers of 10:

210 ~ 103

So:210 ~ 1,000 (thousand)220 ~ 1,000,000 (million)230 ~ 1,000,000,000 (billion)240 ~ 1,000,000,000,000 (trillion)250 ~ 1,000,000,000,000,000 (quadrillion)

Page 41: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 41

KB, MB, GB, TB, PBKilobyte (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)

Page 42: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 42

Kilo, Mega, Giga, Tera, PetaKilobyte (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: ???

Petabyte (PB): 250 bytes ~ 1,000,000,000,000,000 bytes

Desktop: ???

Page 43: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 43

Moore’s LawMoore’s Law: Computing speed and capacity double every

18 to 24 months.In 1965 Gordon Moore (Chairman Emeritus, Intel Corp)

observed the “doubling of transistor density on a manufactured die every year.”

People have noticed that computing speed and capacity are roughly proportional to transistor density.

Moore’s Law is usually hedged by saying that computing speed doubles every 18-24 months (typically 18).

See:http://www.intel.com/technology/mooreslaw/http://www.intel.com/pressroom/kits/quickreffam.htm

Page 44: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 44

Implication of Moore’s Law

If computing speed and capacity double every 18 months, what are the implications in our lives?

Well, the average undergrad student is – to one significant figure – about 20 years old.

And the average lifespan in the US – to one significant figure – is about 80 years.

So, the average undergrad student has 60 years to go.So how much will computing speed and capacity

increase during the time you have left?

Page 45: CS1313 Hardware Lesson - University of Oklahomamarkw/class/cs1313/lecture/... · 2007-01-19 · 17. Main Memory Layout 18. RAM vs ROM 19. Speed => Price => Size 20. How Data Travel

Hardware LessonCS1313 Spring 2007 45

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 day you die.

How much faster will it be?

Can we possibly predict what the future of computing will enable us to do?