Case Studies with Exercises by Andrea C. Arpaci-Dusseau and Remzi H. Arpaci-Dusseau ■ 405
In this case study, we will explore how software can be used to uncover the
internal structure of a storage system hidden behind a block-based interface. The
basic idea is to fingerprint the storage system: by running a well-defined work-
load on top of the storage system and measuring the amount of time required for
different requests, one is able to infer a surprising amount of detail about the
underlying system.
The Skippy algorithm, from work by Nisha Talagala and colleagues at U.C.
Berkeley, uncovers the parameters of a single disk. The key is to factor out disk
rotational effects by making consecutive seeks to individual sectors with
addresses that differ by a linearly increasing amount (increasing by 1, 2, 3, and so
forth). Thus, the basic algorithm skips through the disk, increasing the distance of
the seek by one sector before every write, and outputs the distance and time for
each write. The raw device interface is used to avoid file system optimizations.
The SECTOR SIZE is set equal to the minimum amount of data that can be read at
once from the disk (e.g., 512 bytes). (Skippy is described in more detail in Tala-
gala et al. [1999].)
fd = open("raw disk device");
for (i = 0; i < measurements; i++) {
begin_time = gettime();
lseek(fd, i*SECTOR_SIZE, SEEK_CUR);
write(fd, buffer, SECTOR_SIZE);
interval_time = gettime() -begin_time;
printf("Stride: %d Time: %d\n", i, interval_time);
}
close(fd);
By graphing the time required for each write as a function of the seek dis-
tance, one can infer the minimal transfer time (with no seek or rotational latency),
head switch time, cylinder switch time, rotational latency, and the number of
heads in the disk. A typical graph will have four distinct lines, each with the same
slope, but with different offsets. The highest and lowest lines correspond to
requests that incur different amounts of rotational delay, but no cylinder or head
switch costs; the difference between these two lines reveals the rotational latency
of the disk. The second lowest line corresponds to requests that incur a head
switch (in addition to increasing amounts of rotational delay). Finally, the third
line corresponds to requests that incur a cylinder switch (in addition to rotational
delay).
6.1 [10/10/10/10/10] <6.2> The results of running Skippy are shown for a mock disk
(Disk Alpha) in Figure 6.25.
a. [10] <6.2> What is the minimal transfer time?
b. [10] <6.2> What is the rotational latency?
c. [10] <6.2> What is the head switch time?