Information Technology Reference
In-Depth Information
sectors randomly scattered across the disk. How long will these 10000 re-
quest take (total) assuming the disk services requests using the SCAN/El-
evator algorithm.
9. Suppose I have a disk such as the 320GB SATA drive described in Fig-
ure 12.9 on page 381 and I have a workload consisting of 10000 reads
to sectors randomly scattered across a 100MB file, where the 100MB file
is laid out sequentially on the disk. How long will these 10000 request
take (total) assuming the disk services requests using the SCAN/Elevator
algorithm?
10. Write a program that creates a 100MB file on your local disk and then
measures the time to do each of four things:
(a) Sequential overwrite. Overwrite the file with 100MB of new data
by writing the file from beginning to end and then calling fsync()
(or the equivalent on your platform).
(b) Random buffered overwrite. Do the following 50,000 times:
choose a 2KB-aligned offset in the file uniformly at random, seek
to that location in the file, and write 2KB of data at that position.
Then, once all 50,000 writes have been issued, call fsync() (or the
equivalent on your platform).
(c) Random buffered overwrite.Do the following 50,000 times: choose
a 2KB-aligned offset in the file uniformly at random, seek to that lo-
cation in the file, write 2KB of data at that position, and call fsync()
(or the equivalent on your platform) after each individual write.
(d) Random read. Do the following 50,000 times: choose a 2KB-
aligned offset in the file uniformly at random, seek to that location
in the file, and read 2KB of data at that position.
Explain your results.
11. Write a program that creates three files, each of 100MB, and then measures
the time to do each of three things:
(a) fopen()/fwrite(). Open the first file using fopen() and issue 256,000
sequential four-byte writes using fwrite() .
(b) open()/write(). Open the second file using open() and issue 256,000
sequential four-byte writes using write() .
(c) mmap()/store. Map the third le into your program's memory us-
ing mmap() and issue 256,000 sequential four-byte writes by iterating
through memory and writing to each successive word of the mapped
file.
Search WWH ::




Custom Search