Java Reference
In-Depth Information
platter contains 13,085 tracks and each track contains (after formatting)
256 sectors of 512 bytes/sector. Track-to-track seek time is 2.2 ms and av-
erage seek time for random access is 9.5 ms. Assume the operating system
maintains a cluster size of 8 sectors per cluster (4KB), yielding 32 clusters
per track. The disk rotation rate is 5400 rpm (11.1 ms per rotation). Based
on this information we can estimate the cost for various file processing op-
erations.
How much time is required to read the track? On average, it will require
half a rotation to bring the first sector of the track under the I/O head, and
then one complete rotation to read the track.
How long will it take to read a file of 1MB divided into 2048 sector-
sized (512 byte) records? This file will be stored in 256 clusters, because
each cluster holds 8 sectors. The answer to the question depends largely
on how the file is stored on the disk, that is, whether it is all together or
broken into multiple extents. We will calculate both cases to see how much
difference this makes.
If the file is stored so as to fill all of the sectors of eight adjacent tracks,
then the cost to read the first sector will be the time to seek to the first track
(assuming this requires a random seek), then a wait for the initial rotational
delay, and then the time to read (which is the same as the time to rotate the
disk again). This requires
9:5 + 11:1 1:5 = 26:2 ms:
At this point, because we assume that the next seven tracks require only a
track-to-track seek because they are adjacent. Each requires
2:2 + 11:1 1:5 = 18:9 ms:
The total time required is therefore
26:2ms + 7 18:9ms = 158:5ms:
If the file's clusters are spread randomly across the disk, then we must
perform a seek for each cluster, followed by the time for rotational delay.
Once the first sector of the cluster comes under the I/O head, very little time
is needed to read the cluster because only 8/256 of the track needs to rotate
under the head, for a total time of about 5.9 ms for latency and read time.
Thus, the total time required is about
256(9:5 + 5:9) 3942ms
or close to 4 seconds. This is much longer than the time required when the
file is all together on disk!
Search WWH ::




Custom Search