Академический Документы
Профессиональный Документы
Культура Документы
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. Hardware Outline What is a Computer? Components of a Computer Categories of Computer Hardware Central Processing Unit (CPU) CPU Examples CPU Parts CPU: Control Unit CPU: Arithmetic/Logic Unit CPU: Registers How Registers Are Used Multicore Multicore History Storage Primary Storage Cache From Cache to the CPU Main Memory (RAM) Main Memory Layout RAM vs ROM Speed => Price => Size How Data Travel Between RAM and CPU Loading Data from RAM into the CPU
24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47.
RAM is Slow Why Have Cache? Secondary Storage Media Types Speed, Price, Size CD-ROM & DVD-ROM CD-ROM & DVD-ROM: Disadvantage CD-ROM & DVD-ROM: Advantages Why Are Floppies So Expensive Per MB? I/O I/O: Input Devices I/O: Output Devices Bits Bytes Words Putting Bits Together Putting Bits Together (contd) Powers of 2 Powers of 2 vs Powers of 10 KB, MB, GB, TB, PB Kilo, Mega, Giga, Tera, Peta Moores Law Implication of Moores Law Double, double,
Hardware Lesson
CS1313 Spring 2009
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)
Hardware Lesson
CS1313 Spring 2009
Components of a Computer
Computer
Hardware
Physical Devices
Software
Instructions & Data
DONT PANIC!
This discussion may be confusing at the moment; itll make more sense after youve written a few programs.
Hardware Lesson
CS1313 Spring 2009
Primary: Cache, RAM Secondary: Hard disk, removable (e.g., CD) Input Devices Output Devices
I/O
Hardware Lesson
CS1313 Spring 2009
Harpertown exterior
http://blogs.zdnet.com/Apple/images/intel-xeon.jpg
Hardware Lesson
CS1313 Spring 2009
CPU Examples
Intel Pentium 4/AMD Athlon (Windows PCs) Intel Itanium2 (servers) Qualcomm MSM (cell phones) IBM POWER6 (servers) Sun UltraSPARC (servers)
Hardware Lesson
CS1313 Spring 2009
CPU Parts
The CPU consists of three main parts: Control Unit Arithmetic/Logic Unit Registers
Control Unit
Fetch Next Instruction Fetch Data Store Data
Arithmetic/Logic Unit
Add Mult Sub Div
Registers
Integer
And
Execute Instruction
Or
Floating Point
Not
Hardware Lesson
CS1313 Spring 2009
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.
Hardware Lesson
CS1313 Spring 2009
Hardware Lesson
CS1313 Spring 2009
CPU: Registers
Registers 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.
Hardware Lesson
CS1313 Spring 2009
10
Every 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).
Register Ri Register Rj
operand result
operand
Operation circuitry
Register Rk
Example:
addend in R0
augend in R1
5
7
ADD
12
sum in R2
Hardware Lesson
CS1313 Spring 2009
11
Multicore
A multicore CPU 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 memory and the same bandwidth (memory speed).
Hardware Lesson
CS1313 Spring 2009
12
Multicore History
Dual core: October 2005 Quad core: June 2006 Hex core: September 2008 Oct core: estimated late 2009
Hardware Lesson
CS1313 Spring 2009
13
Storage
There are two major categories of storage: Primary
Cache Main memory (RAM) Hard disk Removable (e.g., CD, floppy)
Secondary
Hardware Lesson
CS1313 Spring 2009
14
Primary Storage
Primary storage is where data and instructions reside when 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:
Hardware Lesson
CS1313 Spring 2009
15
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 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.
Hardware Lesson
CS1313 Spring 2009
16
Cache
Typically, data move between cache and the CPU at speeds comparable to that of the CPU performing calculations.
Hardware Lesson
CS1313 Spring 2009
17
18
19
RAM vs ROM
RAM: 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, Memory and 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 Memory Memory that the CPU can look at arbitrarily, but cannot change.
Hardware Lesson
CS1313 Spring 2009
20
Registers are VERY fast, because they are etched directly into the CPU. Cache is also very fast, because its also etched into the CPU, but it isnt directly connected to the Control Unit or Arithmetic/Logic Unit. Cache operates at speeds similar to registers, but cache is MUCH bigger than 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 isnt part of the CPU; therefore, its much cheaper than cache, and therefore its much bigger than cache (for example, 1,000 times as big).
Hardware Lesson
CS1313 Spring 2009
21
Hardware Lesson
CS1313 Spring 2009
22
Hardware Lesson
CS1313 Spring 2009
23
RAM is Slow
The speed of data transfer 351 GB/sec on a CPU 1.83 GHz Pentium4 between Main Memory and Core Duo the CPU is much slower than the speed of calculating, so Bottleneck the CPU spends most of its time waiting for data to come 10.66 GB/sec (3%) in or go out.
Richard Gerber, The Software Optimization Cookbook: High-performance Recipes for the Intel Architecture. Intel Press, 2002, pp. 161-168.
ftp://download.intel.com/design/Pentium4/papers/24943801.pdf
Hardware Lesson
CS1313 Spring 2009
24
Hardware Lesson
CS1313 Spring 2009
25
Secondary Storage
Where data and instructions reside that are going to be 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 to someone elses.
Hardware Lesson
CS1313 Spring 2009
26
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 rewritten multiple times Contents degrade more slowly than magnetic media Cant be erased by magnets
27
Hard Disk
Blu-ray DVD+RW CD-RW Mag tape Floppy Cassette Paper tape Punch card
100
17 16 7.6 15 0.03 << 1 << 1 << 1
1,500,000
25,000 8500 700 800,000 1.44 << 1 << 1 << 1
Mag
Opt Opt Opt Mag Mag Mag Paper Paper
Y
Y Y Y Y Y Y Y Y
N
Y Y Y Y Y Y Y Y
Reqd
Soon Y Y N Y $120 $24 $14 $2000 $9
$0.0001
$0.0002 $0.00003 $0.0002 $0.00006 $0.09
* Maximum among models commonly available for PCs Note: All numbers are approximate as of Jan 2009 (bestbuy.com, buy.com, cendyne.com, creativelabs.com, dell.com, pcworld.com,pricewatch.com, sony.com, storagetek.com, toshiba.com).
Hardware Lesson
CS1313 Spring 2009
28
CD-ROM/DVD-ROM/BD-ROM
When a CD or DVD or Blu-ray 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; its nonvolatile; it can be addressed essentially arbitrarily (its not actually arbitrary, but its fast enough that it might as well be).
Hardware Lesson
CS1313 Spring 2009
29
CD-ROM/DVD-ROM/BD-ROM: Disadvantage
Disadvantage of CD-ROM/DVD-ROM/BD-ROM compared 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).
Hardware Lesson
CS1313 Spring 2009
30
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 larger they can have arbitrary amount of storage (on many CDs or DVDs); ROM is limited to a few GB.
Hardware Lesson
CS1313 Spring 2009
31
Hardware Lesson
CS1313 Spring 2009
32
I/O
We often say I/O as a shorthand for Input/Output.
Hardware Lesson
CS1313 Spring 2009
33
34
Hardware Lesson
CS1313 Spring 2009
35
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: Boolean value for symbolic logic 0 or 1: Integer value
Bits arent individually addressable: the CPU cant load from or store into an individual bit of memory.
Hardware Lesson
CS1313 Spring 2009
36
Bytes
Byte: a sequence of 8 contiguous bits (typically) On most platforms (kinds of computers), its 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)
Hardware Lesson
CS1313 Spring 2009
37
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)
Hardware Lesson
CS1313 Spring 2009
38
0 0 0
1 0 0
0 0 1
1 0 1
0 1 0
1 1 0
0 1 1
1 1 1
Hardware Lesson
CS1313 Spring 2009
39
40
Powers of 2
20 = 21 = 22 = 1 2 4 211 = 212 = 213 = 2,048 4,096 8,192
23 24 25 26 27 28 29 210
= 8 214 = 16,384 = 16 215 = 32,768 = 32 216 = 65,536 = 64 217 = 131,072 = 128 218 = 262,144 = 256 219 = 524,288 = 512 220 = 1,048,576 (about a million) = 1,024 (about a thousand)
Hardware Lesson
CS1313 Spring 2009
41
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) 30 ~ 1,000,000,000 (billion) 2 40 ~ 1,000,000,000,000 (trillion) 2 250 ~ 1,000,000,000,000,000 (quadrillion) 260 ~ 1,000,000,000,000,000,000 (quintillion)
Hardware Lesson
CS1313 Spring 2009
42
43
Gigabyte (GB):
230 bytes =
1,073,741,824 bytes ~
Desktop: c. 1997
1,000,000,000 bytes
Approximate size: 15 copies of the OKC white pages 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 ~ Desktop: ??? Hardware Lesson
CS1313 Spring 2009
1,000,000,000,000,000 bytes
44
Moores Law
Moores 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. Moores 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
Hardware Lesson
CS1313 Spring 2009
45
46
Double, double,
60 years / 18 months = 40 doublings What 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?
Hardware Lesson
CS1313 Spring 2009
47