Java Reference
In-Depth Information
This requires the ability to guess accurately what information will be needed later
and store it in primary memory now. This is referred to as caching.
8.2
Disk Drives
A Java programmer views a random access file stored on disk as a contiguous
series of bytes, with those bytes possibly combining to form data records. This
is called the logical file. The physical file actually stored on disk is usually not
a contiguous series of bytes. It could well be in pieces spread all over the disk.
The file manager, a part of the operating system, is responsible for taking requests
for data from a logical file and mapping those requests to the physical location
of the data on disk. Likewise, when writing to a particular logical byte position
with respect to the beginning of the file, this position must be converted by the
file manager into the corresponding physical location on the disk. To gain some
appreciation for the the approximate time costs for these operations, you need to
understand the physical structure and basic workings of a disk drive.
Disk drives are often referred to as direct access storage devices. This means
that it takes roughly equal time to access any record in the file. This is in contrast
to sequential access storage devices such as tape drives, which require the tape
reader to process data from the beginning of the tape until the desired position has
been reached. As you will see, the disk drive is only approximately direct access:
At any given time, some records are more quickly accessible than others.
8.2.1
Disk Drive Architecture
A hard disk drive is composed of one or more round platters, stacked one on top of
another and attached to a central spindle. Platters spin continuously at a constant
rate. Each usable surface of each platter is assigned a read/write head or I/O
head through which data are read or written, somewhat like the arrangement of
a phonograph player's arm “reading” sound from a phonograph record. Unlike a
phonograph needle, the disk read/write head does not actually touch the surface of
a hard disk. Instead, it remains slightly above the surface, and any contact during
normal operation would damage the disk. This distance is very small, much smaller
than the height of a dust particle. It can be likened to a 5000-kilometer airplane trip
across the United States, with the plane flying at a height of one meter!
A hard disk drive typically has several platters and several read/write heads, as
shown in Figure 8.2(a). Each head is attached to an arm, which connects to the
boom. 2 The boom moves all of the heads in or out together. When the heads are
in some position over the platters, there are data on each platter directly accessible
2 This arrangement, while typical, is not necessarily true for all disk drives. Nearly everything
said here about the physical arrangement of disk drives represents a typical engineering compromise,
not a fundamental design principle. There are many ways to design disk drives, and the engineering
Search WWH ::




Custom Search