Chapter 3
(continued)
§
Disk I/O example
§
Assume
a disk with
§
cluster
size of 8 sectors (4,096 bytes)
§
smallest
extent of 5 clusters
§
sector
interleave factor of 1
§
space
is allocated for storing files in one-track units
§
Assume
a file with 8,000 256-byte records (2,048K byte file)
§
each
4,096-byte cluster holds 16 records
§
the
file is composed of 500 4,096 bye clusters
§
the
file contains 500 clusters, occupying 100 extents, occupying 100 tracks
§
assume
the tracks are dispersed randomly across the disk
§
Suppose
we wish to update 10% of the records in a sorted version of the file with a set
of transactions.
§
Sequential Access Solution: Sort the transactions and then merge the transactions against the
master. (Ignore the sort time and
transaction read time for now).
§
We
must read all 100 tracks in the file to get the 10%
§
The
speed to read one track is:
Average seek time 18.0
msec
Rotational delay 8.3
msec
Read one track 16.7
msec
Total 43.0
msec
§
The
time to read all 100 tracks is:
Total time = 100 x 43 msec = 4,300 msec = 4.3 seconds
§
Random Access Solution: Update only master
records that match the transactions.
§
We
must read 800 tracks from the file, one for each transaction record (800 = 10%
x 8,000)
Average
seek 18.0
msec
Rotational
delay 8.3 msec
Read one cluster (1/5 x 16.7) 3.3
msec
Total 29.6
msec
Total time = 800 x 29.6 msec = 23,680 msec = 23.68 seconds
§
Even
though only a small fraction of the master file records are to be processed,
processing all the records is sometimes faster than processing the fraction.
§
Wasted Space on Disk
§
See
website: http://www.lantechatl.com/tips/misc/htm
§
See
handout from website
§
Methods for improving disk
performance
§
Multiprogramming
§
Run
other programs while disk I/O is being performed
§
Can
be a problem if the other programs move the read head to another location
§
Striping
§
Spread
the data in a file across multiple drives and read all parts of the data
simultaneously (in parallel).
§
Works
best if consecutive cylinders in the file are different drives – while one
drive reads, another seeks the next cylinder.
Usually requires several (more than 2) drives to work with no delay.
§
RAM
disks
§
Simulate
the operation of a disk using memory
§
Volatile
memory can be problems if failure occurs
§
Slow
CPUs may not provide adequate speedup
§
Disk
Cache
§
Buffer
disk I/O with a Not-Recently-Used
algorithm
§
Many
reads can be satisfied from memory and thus requires no disk delay
§
Works
best if disk access has reasonable locality
of reference.
§
Can
be coupled with the elevator
algorithm
§
Can
be problems following disk failure
§
Magnetic Tape
§
Show-and-tell
tape
§
Serial
access only
§
Nine-track
tape
§
each
byte occupies a frame
§
8
data bits and 1 parity bit (odd or even)
§
Interblock
gaps
§
Performance
is dependent on:
§
Density
– 800, 1,600, 6,250 and 30,000 bpi
§
Speed
– 30 to 200 inches per second
§
Size
of interblock gap – 0.3 to 0.75 inches
§
Tape
length calculations
b = physical length of a data block
g = length of an interblock
gap
n = number of data blocks
the tape length required for a file would be:
s = n * (b + g)
b = block size (bytes per block)
tape density (bytes per
inch)
§
How
much tape would be required for a file of 1,000,000 100 byte records, blocked:
100 records per block?
1000
records per block?
§
Most
tapes range in length from 300 feet to 3,600 feet with 2,400 feet being the
most common length
§
Data
transmission rate:
Nominal rate = tape density (bpi) x tape speed (ips)
§
Effective
transmission rate must include gaps in calculations
§
2-Way Merge Application