Fall 2002 CSCI 333 Homework 5
This homework is not graded. It is practice for the 18 November quiz.
Problem 1
Consider an old-fashioned unzoned disk
drive with the following characteristics.
- 8 GB total storage
- 8 surfaces
- 2048 cylinders
- no interleaving
- rotational speed of 6,000 rpm
- track-to-track seek time of 4 msec
- average seek time of 13 msec
The questions
Answer the following questions regarding the disk drive
describe above.
- How many 512 byte sectors are on this disk drive?
- How many total tracks (on all cylinders) are on this disk drive?
- How many sectors are stored on each single track?
- How many sectors are stored on each cylinder?
- How long, in msec, does it take this disk to rotate?
- How many bytes can be read in one disk rotation?
- What is the average rotation delay in reading from the disk?
- What is the average time, in msec, required to read a random sector
of data from the disk?
- If a 80Mbyte file could be stored in consecutive sectors of the disk,
how many cylinders and tracks would it require?
- How long would it take to read this 80Mbyte file stored in
consecutive sectors?
Problem 2
A file contains a sequence of integers, possibly separated by
commas. Write a C++ subroutine which is passed an istream
that has been opened to this file and returns the sum of all the
integers in the file. Return -1 is the file is not in the correct
format.
Here is an example of the file input:
35 67, 89
13 5
13, 67
Here is a header for your function:
int SumEm(istream NumS)
Problem 3
Write some C++ statements to replace the fifth character of a file
with the character 'X'.