You are on page 1of 75

William Stallings

Computer Organization
and Architecture
7th Edition

Chapter 6
External Memory
Types of External Memory
• Magnetic Disk
—RAID
—Removable
• Optical
—CD-ROM
—CD-Recordable (CD-R)
—CD-R/W
—DVD
• Magnetic Tape
Magnetic Disk
• A disk is a circular platter constructed of
nonmagnetic material, called the
substrate, coated with a magnetizable
material.
• Traditionally, the substrate has been an
aluminum or aluminum alloy material.
Magnetic Disk
• More recently, glass substrates have been
introduced.
—Improved surface uniformity
– Increases reliability
—Reduction in surface defects
– Reduced read/write errors
—Lower flight heights (See later)
—Better stiffness
—Better shock/damage resistance
Read and Write Mechanisms
• Data are recorded on and later retrieved
from the disk via a conducting coil named
the head;
• In many systems, there are two heads, a
read head and a write head.
• During a read or write operation, the head
is stationary while the platter rotates
beneath it.
Read and Write Mechanisms
• The write mechanism exploits the fact
that electricity flowing through a coil
produces a magnetic field.
• Electric pulses are sent to the write head,
and the resulting magnetic patterns are
recorded on the surface below, with
different patterns for positive and
negative currents.
Read and Write Mechanisms
• The traditional read mechanism exploits
the fact that a magnetic field moving
relative to a coil produces an electrical
current in the coil.
• When the surface of the disk passes under
the head, it generates a current of the
same polarity as the one already
recorded.
Read and Write Mechanisms
• The read head consists of a partially
shielded magneto resistive (MR) sensor.
• The MR material has an electrical
resistance that depends on the direction
of the magnetization of the medium
moving under it.
Inductive Write MR Read
Data Organization and Formatting
• The head is a relatively small device
capable of reading from or writing to a
portion of the platter rotating beneath it.
• This gives rise to the organization of data
on the platter in a concentric set of rings,
called tracks.
• Each track is the same width as the head.
There are thousands of tracks per surface.
Data Organization and Formatting
• Adjacent tracks are separated by gaps.
• This prevents, or at least minimizes,
errors due to misalignment of the head or
simply interference of magnetic fields.
• Data are transferred to and from the disk
in sectors.
• There are typically hundreds of sectors
per track.
• Either fixed or variable length.
Data Organization and Formatting
• In most contemporary systems, fixed-
length sectors are used, with 512 bytes
being the nearly universal sector size.
• To avoid imposing unreasonable precision
requirements on the system, adjacent
sectors are separated by intersector gaps.
Disk Data Layout
Disk Velocity
• Bit near centre of rotating disk passes fixed point
slower than bit on outside of disk
• Increase spacing between bits in different tracks
• Rotate disk at constant angular velocity (CAV)
— Gives pie shaped sectors and concentric tracks
— Individual tracks and sectors addressable
— Move head to given track and wait for given sector
— Waste of space on outer tracks
– Lower data density
• Can use zones to increase capacity
— Each zone has fixed bits per track
— More complex circuitry
Disk Layout Methods Diagram
Finding Sectors
• Must be able to identify start of track and
sector
• Format disk
—The disk is formatted with some extra
data(control data) used only by the disk drive.
—Additional information not available to user
—Marks tracks and sectors
Winchester Disk Format
Seagate ST506
Physical Characteristics
• Fixed (rare) or movable head
• Removable or fixed
• Single or double (usually) sided
• Single or multiple platter
• Head mechanism
—Contact (Floppy)
—Fixed gap
—Flying (Winchester)
Fixed/Movable Head Disk
• Fixed head
—In a fixed-head disk, there is one read-write
head per track
—All of the heads are mounted on a rigid arm
that extends across all tracks; such systems
are rare today
• Movable head
—In a movable-head disk, there is only one
read-write head
—Again, the head is mounted on an arm
—Because the head must be able to be
positioned above any track, the arm can be
extended or retracted for this purpose
Removable or Not
• Removable disk
—Can be removed from drive and replaced with
another disk
—Provides unlimited storage capacity
—Easy data transfer between systems
• Nonremovable disk
—Permanently mounted in the drive
Multiple Platter
• One head per side
• Heads are joined and aligned
• Aligned tracks on each platter form
cylinders
• Data is striped by cylinder
—reduces head movement
—Increases speed (transfer rate)
Multiple Platters
Tracks and Cylinders
Floppy Disk
• 8”, 5.25”, 3.5”
• Small capacity
—Up to 1.44Mbyte (2.88M never popular)
• Slow
• Universal
• Cheap
• Obsolete?
Winchester Hard Disk (1)
• Developed by IBM in Winchester (USA)
• One or more platters (disks)
• Heads fly on boundary layer of air as disk
spins
• Very small head to disk gap
• Universal
• Cheap
• Fastest external storage
• Getting larger all the time
—250 Gigabyte now easily available
Speed
• Seek time
—Seek time is the time required to move the
disk arm to the required track
• (Rotational) latency
—Waiting for data to rotate under head
• Access time = Seek + Latency
Timing of Disk I/O Transfer
RAID: Introduction
• RAID stands for Redundant Array of
Independent Disks
• A system of arranging multiple disks for
redundancy (or performance)
• Set of physical disks viewed as single
logical drive by O/S
• Data distributed across physical drives
• Term first coined in 1987 at Berkley
• RAID is now an umbrella term for various
disk arrangements
—Not necessarily redundant
RAID 0
• Block level “Striping”
• Each subsequent block is written to a
different disk
• It provides improved performance and
additional storage but no fault tolerance.
RAID 0 Writes

RAID
Controll D
G
H
C
B
A
E
F
er
RAID 0 Reads

RAID
Controll
er

A B
C D
E F
G H
RAID 0 Recovery

RAID
Controll
er

A B
C D
E F
G H
RAID 0 Pros
• Best use of space
—Every byte of the disks can be accessed in the
array
• Very fast reads and writes
—The more disks you add to the array, the
faster it goes
• Simple design and operation
—No parity calculation
RAID 0 Cons
• No redundancy
• Not for use in mission critical systems
• One disk failure means all your data is
unrecoverable
RAID 1
• Known as “Mirroring”
• Data is written to two disks concurrently
• The first type of RAID developed
RAID 1 Writing

RAID
Controll D
C
B
A
er
RAID 1 Reading

RAID
Controll
er

A A
B B
C C
D D
RAID 1 Recovery

RAID
Controll
er

A A
B B
C C
D D
RAID 1 Pros
• Good redundancy
—Two copies of every block
• Fast reads
—Can read 2 blocks at once (more if more
disks)
• Writes are acceptable
• No intense calculation on rebuild, just
copy
RAID 1 Cons
• SPACE!!
• Using 2 disks gives you 1/2 the space,
using 3 gives 1/3 etc…
• Writes are not as fast as other RAID types
• Very expensive
RAID 4
• Striping with a dedicated parity disk
• Blocks are written to each subsequent
disk
• Each block of the parity disk is the XOR
value of the corresponding blocks on the
data disks
RAID 4 Writing

RAID
Controll A3
A2
A1
AP
er
RAID 4 Writing

Block Data
A1 11110000
A2 11001100
A3 10101010
AP
RAID 4 Writing

Block Data
A1 11110000
A2 11001100
A3 10101010
AP 1
RAID 4 Writing

Block Data
A1 11110000
A2 11001100
A3 10101010
AP 10
RAID 4 Writing

Block Data
A1 11110000
A2 11001100
A3 10101010
AP 100
RAID 4 Writing

Block Data
A1 11110000
A2 11001100
A3 10101010
AP 1001
RAID 4 Writing

Block Data
A1 11110000
A2 11001100
A3 10101010
AP 10010
RAID 4 Writing

Block Data
A1 11110000
A2 11001100
A3 10101010
AP 100101
RAID 4 Writing

Block Data
A1 11110000
A2 11001100
A3 10101010
AP 1001011
RAID 4 Writing

Block Data
A1 11110000
A2 11001100
A3 10101010
AP 10010110
RAID 4 Writing

RAID
Controll B3
B2
B1
BPA1 A2 A3 AP
er

C1 C2 C3 CP
D1 D2 D3 DP
RAID 4 Modifying

1001
0000
Write 0011 to disk 3

RAID
Controll 0011

er

A1
1111 A2
1100 A3
1010 AP
1001

B1 B2 B3 BP
C1 C2 C3 CP
D1 D2 D3 DP
RAID 4 Recovery

D1
C1
A1
B1
1111 1100 1010 1001

RAID
Controll
er

A1 A2 A3 AP
B1 B2 B3 BP
C1 C2 C3 CP
D1 D2 D3 DP
RAID 4 Pros
• Low ratio of error correction space
—Any number of data disks only require 1 parity
disk. 4 disks gives 3/4 usable space 5 gives
4/5
• Can recover from single disk failures
RAID 4 Cons
• Very slow writes
—Every write requires 2 reads and 2 writes
—Every write requires accessing the single
parity disk
• Recovery is processor intensive
RAID 5
• Striped disks with interleaved parity
• Much like RAID 4 except that parity blocks
are spread over every disk
RAID 5

RAID
Controll
er

AP A2 A3 A4
B1 BP B3 B4
C1 C2 CP C4
D1 D2 D3 DP
RAID 5 Pros
• Because parity bits are distributed, every
write does not need to access a single
disk
—Writes are marginally better than RAID 4
RAID 5 Cons
• Re-writing a block still requires 2 reads
and 2 writes
• Rebuilding the array takes a long time
• Can only tolerate one disk failure
RAID 2
• Striped set with dual distributed parity
• Defined as any form of RAID that can
recover from two concurrent disk failures
• Essentially RAID 5 with an extra parity
disk
RAID 2 Error Correction
Using Hamming Codes

Data Redundant
Disk 1 2 3 4 5 6 7
1 1 1 0 1 0 0
1 1 0 1 0 1 0
1 0 1 1 0 0 1
Data Redundant
Hamming Code
Dis 1 2 3 4 5 6 7
k
1 1 1 0 1 0 0
1 1 0 1 0 1 0
1 0 1 1 0 0 1

Data
Dis Contents
k
1 11110000
2 ????????
3 00111000
4 01000001
5 ????????
6 10111110
7 10001001
Data Redundant
Hamming Code
Dis 1 2 3 4 5 6 7
k
1 1 1 0 1 0 0
1 1 0 1 0 1 0
1 0 1 1 0 0 1

Data
Dis Contents
k No Good! Disk 2 has failed.
1 11110000
2 ????????
3 00111000
4 01000001
5 ????????
6 10111110
7 10001001
Data Redundant
Hamming Code
Dis 1 2 3 4 5 6 7
k
1 1 1 0 1 0 0
1 1 0 1 0 1 0
1 0 1 1 0 0 1

Data
Dis Contents
k Great. We can recover disk 2 by using disks
1 11110000 1, 4, and 6. XOR them all and we get…

2 ????????
3 00111000
4 01000001
5 ????????
6 10111110
7 10001001
Data Redundant
Hamming Code
Dis 1 2 3 4 5 6 7
k
1 1 1 0 1 0 0
1 1 0 1 0 1 0
1 0 1 1 0 0 1

Data
Dis Contents
k
1 11110000
2 00001111
3 00111000
4 01000001
5 ????????
6 10111110
7 10001001
Data Redundant
Hamming Code
Dis 1 2 3 4 5 6 7
k
1 1 1 0 1 0 0
1 1 0 1 0 1 0
1 0 1 1 0 0 1

Data
Dis Contents
k Now we can see disk 5 is the parity bit for
1 11110000 disks 1,2,3. XOR them all and we have
recovered from two disk failures.
2 00001111
3 00111000
4 01000001
5 ????????
6 10111110
7 10001001
Data Redundant
Hamming Code
Dis 1 2 3 4 5 6 7
k
1 1 1 0 1 0 0
1 1 0 1 0 1 0
1 0 1 1 0 0 1

Data
Dis Contents
k
1 11110000
2 00001111
3 00111000
4 01000001
5 11000111
6 10111110
7 10001001
RAID 2 Pros
• Very fault tolerant
• As rebuild times increase, having extra
fault tolerance is becoming more
important
Raid 2 Cons
• About the same performance write speed
as RAID 5. More reads and writes are
required, but most can be done
concurrently.
• Requires more parity space than RAID 5
• Very computationally expensive
RAID 3
• Bit-interleaved parity
• Only one redundant disk, no matter how
large the array
• Simple parity bit for each set of
corresponding bits
• Data on failed drive can be reconstructed
from surviving data and parity info
• This is not commonly used.
RAID 6
• Two parity calculations
• Stored in separate blocks on different
disks
• High data availability
—Three disks need to fail for data loss
RAID 0, 1, 2
RAID 3 & 4
RAID 5 & 6

You might also like