Overview of Computer Science

advertisement
Overview of Computer Science
CSC 101 — Summer 2011
Main Memoryy vs. Auxiliary
y Storage
g
Lecture 7 — July 14, 2011
Announcements
Writing Assignment #2 due Today (5:00pm)
- Post on your CSC101 webpage
- Ask if you have questions!
Lab #2 Today
Quiz #1 Tomorrow (Lectures 1 - 7)
2
Objectives
•
•
•
•
Important points from yesterday’s lecture
How main memory is constructed
Differences between main memory and auxiliary storage
Look at how various storage devices work
– Magnetic Tape
– Hard Drives
– CD-ROM / CD-RW / DVD
3
1
The von Neumann Architecture
• All modern computers follow the logical model of
computing called the von Neumann Architecture
Computer organized into four main sections:
– Central Processing Unit (CPU)
• All of the computer’s operations
and calculations
– Main Memory
• Active data and programs
– Auxiliary Storage
• Disks and other storage devices
– I/O Subsystem
• Input and output “peripherals”
4
Program Interpretation Cycle
• Programs exist in main memory while they are running
– Everything in memory is just binary bits
• Bit patterns can represent many types of information
– Certain bit patterns represent specific computer instructions
• The
Th CPU executes programs one instruction
i
i at a time
i
–
–
–
–
Fetch a binary word from main memory
Decode the instruction in that word
Execute the instruction
Repeat until done,
a billion times per second
Execute
Fetch
Decode
• Computers are very dumb
– They can only do very simple things
(machine language instructions) – next week
5
Main Memory
• Main memory generally uses
Random Access Memory (RAM)
– General use
• For programs and data
– Very fast
• Can keep up with fast CPUs
– Expensive
– Volatile
• Data disappears when
powered off
– Comprised of flip-flop circuits
6
2
Boolean Logic Review
• The basic values in Boolean logic are
– TRUE
– FALSE
– There are two possible values (just like binary data!)
• TRUE can be represented by a 1 bit
• FALSE can be represented by a 0 bit
7
Boolean Logic Review
• NOT
–
–
–
–
X = A’
If A is FALSE, then A’ is TRUE
If A is TRUE,, then A’ is FALSE
X is always the opposite of A
8
Boolean Logic Review
• AND
– X = A • B (or just X = AB)
– If A is TRUE, AND B is TRUE,
then A
A•B
B is TRUE;
otherwise A•B is FALSE
9
3
Boolean Logic Review
• OR
– X = A + B
– If either A OR B is TRUE,
then A+B is TRUE;
otherwise A+B is FALSE
10
Flip--Flop Circuit
Flip
• A circuit that can ‘remember’ a value is called a flip-flop circuit
– Also called an S-R latch
• If Q = 1, the circuit is storing a 1 bit
• If Q = 0, the circuit is storing a 0 bit
– A
As long
l
as S and
d R are both
b h 0,
0
the Q output remains unchanged
– If S (“set”) is changed momentarily to 1,
Q becomes 1 (regardless of its previous value)
– If R (“reset”) is changed momentarily to 1,
Q becomes 0 (regardless of its previous value)
• A flip-flop is one bit of memory
– There are billions of these flip-flops in your laptop’s memory
11
Auxiliary Storage
• Main memory contains data and instructions that are in
active use
• Auxiliary storage is
for data and programs
that aren’t in active use
– Usually disk drives
or flash memory
12
4
Auxiliary Storage vs. Main Memory
Secondary
Auxiliary Storage
Storage
Main Memory
Non-volatile (“permanent”)
Volatile
Much greater capacity possible
(“infinite” expansion)
Limited capacity and expansion
possibilities
Much cheaper per MB than RAM
More expensive
Much slower than RAM
Very high speed access
• Auxiliary storage devices and media choices based on
– Capacity
– Speed
– Cost
13
Types of Auxiliary Storage
• Auxiliary storage that is always available (like
your laptop’s hard disk) is called online storage
• Removable storage
g devices ((like a CD-ROM or a
USB jump drive) are called offline storage
• Three broad types of auxiliary storage
– Sequential Access (Magnetic Tape)
– Direct Access (Hard Drives / CDs / DVDs)
– Random Access (Jump Drives / Memory Cards)
14
Types of Auxiliary Storage
• Sequential Access Storage Devices (SASD)
– Data items are organized in a linear sequence
– Access time is highly variable
• Items near the beginning of the sequence are accessed
quickly, but accessing items near the end may take
a long time
• Off-line storage
• Example
– Magnetic tape
15
5
Magnetic Tape
UNIVAC 1
IBM System/360
(1952)
(1960’s
Æ
1980’s)
• Tape drives provided online storage when hard disks
were too expensive or not yet invented
– Now hard disks usually used for archive storage (offline)
16
Archival Data Storage
• Because tape is sequential access, it is
no longer appropriate for online storage
• But, because it is very cheap and compact
per GB,
GB iis iis very appropriate
i t for
f archival
hi l storage
t
(data backup)
• For lots of data, need lots of
tape cartridges
– Need to be able to automatically
change tapes
IBM 3580 – 100 GB (100 billion bytes)
17
Archival Data Storage
• Automated tape libraries or ‘robots’ can manage very large
numbers of tape cartridges
IBM 3494 - ~1 PB (1 quadrillion bytes)
18
6
How Magnetic Tape Works
• Remember that binary data is a collection of bits
– Bits can be 1–0, on–off, yes–no, left–right…
any two-state information
• Bits can be represented by magnetization of tiny
metallic particles on the surface of a strip of tape
– Each metallic particle is like a small magnet
– Aligned particles pointing one way represent a 0
– Aligned particles pointing the other way represent a 1
19
How Magnetic Tape Works
• Magnetic tape is composed of a very large number of
microscopic magnetic particles
• These tiny particles are
initially aligned randomly
• If a magnet is held up to the tape, the particles all become
aligned to the magnet
S
N
• Different sections of the tape can be magnetized oppositely.
The sections of tape then have
one of two states, and so can
0
0
1
0
represent binary information
20
Types of Auxiliary Storage
• Direct Access Storage Devices (DASD)
– Data items are independently addressed in regions
– Access time is mostly constant
– Most common form of auxiliary storage used in PCs
• Examples
– Hard disks
• On-line storage
– Optical disks and
floppy disks
• Removable,
off-line storage
21
7
Direct Access Storage Devices
• Magnetic hard disks and floppy disks
• Optical disks
(CD-ROM, CD-R, DVD-R,
DVD-RW
DVD
RW, DVD+RW,
DVD+RW etc.)
etc )
• Common geometry – all
arranged in tracks and sectors
• Each sector
contains
many words
of data
22
DASD Media
• While the disk is spinning:
– Seek time:
the read/write head advances to proper
track
– Latency time:
wait for the proper sector to rotate
under the read/write head
– Read/write time:
the read/write head scans the sector for
read or write
– Data transfer rate:
the average rate of sending or
retrieving data from the disk (MB/sec)
23
Magnetic Disks
Diameter (in)
Floppy
Disks
Laptop
Hard Disks
Highperformance
Hard Disks
3½
2½
3½
Typical Capacity (GB)
0.00144
80
512
Rotation speed (RPM)
600
5400
up to 10,000
Avg. data transfer rate
(MB/sec)
½
15-30
50-500
Avg. seek time (ms)
95
12
6
170
7
3
Avg. latency time (ms)
24
8
Optical Disks
• CD-ROM (Compact Disk–Read-Only Memory)
– Factory-produced (pressed) for published information
• CD-R (Compact Disk–Recordable)
– Can be recorded ((“burned”)
burned ) by
desktop devices
– Readable by CD-ROM readers
• CD-RW (Compact Disk–Re-writable)
– Writable and erasable by desktop devices
– Can be used as on-line storage
• DVD (D V D)
– Similar to CD, but higher storage capacity
Thousands
of tracks
25
CD--ROM
CD
• Disks are mastered and
pressed in a factory
• Binary data is stored as
depressions
p
((“pits”)
p ) on a
metallic surface (“land”)
– Pit = “1”, Land = “0”
• Nonerasable, nonwritable
• Laser beam reads data by
reflecting off the pits
and land areas
26
CD--R
CD
• Disks are individually
written (“burned”)
• High-intensity laser burns
darkened dye spots on
grooved tracks
grooved tracks
burned dye spots
– Spot = “1”, no spot = “0”
• Writable, but not erasable
• Laser reads data by
reflecting off dye spots
27
9
CD--RW
CD
• Disks are individually written
• Laser aligns microscopic
crystals in grooved tracks
grooved tracks
aligned crystals
– Aligned crystals look dark;
unaligned crystals look bright
– Dark = “1”, bright = “0”
• Writable, and erasable
• Laser reads data by reflecting
off spots of aligned or
unaligned crystals
unaligned crystals
28
Optical Disk Technology
• Electron micrographs:
– CD-ROM (pits and lands)
– CD-R (burned dye spots)
29
Optical Disk Technology
• Electron micrographs:
– CD-RW (aligned liquid crystals)
Source: http://www.blu-raydisc.com/Assets/Downloadablefile/BD-REwhitepaper20060227clean-15266.pdf, p. 23.
30
10
CD vs. DVD
• CD, DVD and Blu-ray all use similar technologies, just
higher densities (more bits per square inch)
Format
Capacity
CD-ROM
650 MB
DVD-ROM
4.7 GB – 18 GB
Blu-ray (ROM)
25 GB – 50 GB
31
Source: Blu-ray Disc Association
32
Types of Auxiliary Storage
• Random Access Storage
– Data words are addressed individually
– Access time is constant (same for all data words,
regardless of location)
• Usually off-line storage
• Examples
– USB ‘jump drives’
– Memory cards
33
11
Storage Tradeoffs
• Tradeoffs between access speed,
convenience, and cost of memory
– Faster access is usually more expensive
• Large, archival storage systems usually use
magnetic tape because of the low cost
34
12
Download